Last active
August 29, 2015 14:24
-
-
Save BasThomas/b71e8d866fad54d42cf3 to your computer and use it in GitHub Desktop.
Enums in Xcode 7 beta 3
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
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