Created
June 1, 2016 07:15
-
-
Save SteveRohrlack/8fce263d163835c9bcdd244a01d7aa4c to your computer and use it in GitHub Desktop.
swift enumerations with named associated values
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
enum MonitorType { | |
case widescreen(size: Int, refreshRate: Int, manufacturer: String) | |
case ultrawidescreen(size: Int, refreshRate: Int, manufacturer: String) | |
} | |
let widescreenMonitor: MonitorType = .widescreen(size: 26, refreshRate: 6, manufacturer: "Apple") | |
let ultraWidescreenMonitor: MonitorType = .ultrawidescreen(size: 28, refreshRate: 6, manufacturer: "Eizo") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment