Skip to content

Instantly share code, notes, and snippets.

@yarneo
Created February 6, 2016 19:52
Show Gist options
  • Save yarneo/bb872ae9cae01c4b4996 to your computer and use it in GitHub Desktop.
Save yarneo/bb872ae9cae01c4b4996 to your computer and use it in GitHub Desktop.
enum Person {
case FullName(String)
case personID(Int)
init(personID: Int) {
if personID == 123456789 {
self = .FullName(“Barack Obama”)
} else {
self = .personID(personID)
}
}
}
let president: Person = Person(personID: 123456789)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment