Skip to content

Instantly share code, notes, and snippets.

@SteveRohrlack
Last active October 5, 2016 06:54
Show Gist options
  • Save SteveRohrlack/9adfb77051b9797ff98f8dd435f6ffca to your computer and use it in GitHub Desktop.
Save SteveRohrlack/9adfb77051b9797ff98f8dd435f6ffca to your computer and use it in GitHub Desktop.
Apple framework enum vs custom enum
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