Skip to content

Instantly share code, notes, and snippets.

@phynet
Created September 27, 2017 11:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phynet/ac2cf03bdbeed1fdab40dfe1103e8ed6 to your computer and use it in GitHub Desktop.
Save phynet/ac2cf03bdbeed1fdab40dfe1103e8ed6 to your computer and use it in GitHub Desktop.
To use other value of enums rawValue: enum person -> person.RawValue is now person.string
extension RawRepresentable where RawValue == Int {
var number: Int {
return rawValue
}
}
extension RawRepresentable where RawValue == String {
var string: String {
return rawValue
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment