Skip to content

Instantly share code, notes, and snippets.

@polac24
Created August 26, 2017 16:54
Show Gist options
  • Save polac24/12989616f1b89296df6954bb1692f0a8 to your computer and use it in GitHub Desktop.
Save polac24/12989616f1b89296df6954bb1692f0a8 to your computer and use it in GitHub Desktop.
enum BestEnum:RawRepresentable{
case myCase
case otherCase
init?(rawValue: String) {
switch (rawValue){
case "my_case": self = .myCase
case "other_case": self = .otherCase
default: return nil
}
}
var rawValue: String{
switch(self){
case .myCase: return "my_case"
case .otherCase: return "other_case"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment