Skip to content

Instantly share code, notes, and snippets.

@BasThomas
Last active August 29, 2015 14:24
Show Gist options
  • Save BasThomas/b71e8d866fad54d42cf3 to your computer and use it in GitHub Desktop.
Save BasThomas/b71e8d866fad54d42cf3 to your computer and use it in GitHub Desktop.
Enums in Xcode 7 beta 3
import Foundation
enum Number: Int {
case Zero
case One
case Two
case Three
}
enum NumberString: String {
case Zero
case One
case Two
case Three
}
let zero: Number = .Zero // .Zero
let numberZero = zero.rawValue // 0
let one: Number = .One // .One
let numberOne = one.rawValue // 1
let zeroNumber: NumberString = .Zero // .Zero
let zeroNunberString = .Zero.rawValue // "Zero"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment