Last active
February 5, 2018 08:01
-
-
Save d-date/e3a5e545ad7f6e27eab51416bd9b9b4f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum Hoge { | |
case oneValue(one: String) | |
case twoValue(one: String, two: String) | |
var description: String { | |
switch self { | |
case .oneValue(let one): return "\(one)" | |
case .twoValue(let one): return "\(one)" // `one` is treated as tuple, unexpectedly | |
} | |
} | |
} | |
let one = Hoge.oneValue(one: "1") | |
print(one.description) // 1 | |
let two = Hoge.twoValue(one: "1", two: "2") | |
print(two.description) // "(one: "1", two: "2")" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment