Skip to content

Instantly share code, notes, and snippets.

@polac24
Last active August 28, 2017 20:42
Show Gist options
  • Save polac24/875d520c84d6329a8998d9f87eb98101 to your computer and use it in GitHub Desktop.
Save polac24/875d520c84d6329a8998d9f87eb98101 to your computer and use it in GitHub Desktop.
import EnumList
enum BestEnum: EnumListStringRaw<BestEnum.Values>, RawRepresentable{
struct Values:StringEnumValues {
typealias Element = BestEnum
static var allRaws:Set<String> = []
}
case myCase = "my_case"
case otherCase = "otherCase"
}
BestEnum.Values.all // Set([.myCase, .otherCase])
BestEnum.Values.allRaws // Set(["my_case", "otherCase"])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment