Created
August 5, 2015 08:29
-
-
Save Bersaelor/178b4195c24d1660b7ad to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Fonts { | |
case H1 | |
case H2 | |
case H3 | |
case SomethingElse(value: String) | |
var jsonKey: String { | |
switch self { | |
case H1: | |
return "H1" | |
case H2: | |
return "H2" | |
case H3: | |
return "H3" | |
case SomethingElse(let value): | |
return value | |
} | |
} | |
init(rawValue: String) { | |
switch rawValue { | |
case "H1": | |
self = .H1 | |
case "H2": | |
self = .H2 | |
case "H3": | |
self = .H3 | |
default: | |
self = .SomethingElse(value: rawValue) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment