Last active
October 5, 2016 06:54
-
-
Save SteveRohrlack/9adfb77051b9797ff98f8dd435f6ffca to your computer and use it in GitHub Desktop.
Apple framework enum vs custom enum
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 UIKit | |
// Mark: custom enum | |
enum Toast: Int { | |
case raw = 1 | |
case black | |
} | |
if let toast = Toast.init(rawValue: 999) { | |
print("it's a toast!") | |
} else { | |
print("no toast available") | |
} | |
// Mark: UIKit enum | |
if let barStyle = UIBarStyle.init(rawValue: 9999999) { | |
print("some kind of barstyle?") | |
} else { | |
print("no barstyle available") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment