Created
September 27, 2017 11:36
-
-
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
This file contains 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
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