Created
February 27, 2018 11:57
-
-
Save jinSasaki/90eac4ef72326946fe19a546d0565289 to your computer and use it in GitHub Desktop.
This file contains 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
struct Model { | |
enum State: Int { | |
case none, loaded | |
} | |
let value: Int | |
var state: State? { return State(rawValue: value) } | |
func p() { | |
if state == .none { | |
print("A") | |
} else if state == .loaded { | |
print("B") | |
} else { | |
print("C") | |
} | |
} | |
} | |
Model(value: 0).p() | |
Model(value: 1).p() | |
Model(value: 2).p() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment