Last active
May 12, 2016 07:59
-
-
Save jon-cotton/e7829f30513db7097b8e3b0a06292dd0 to your computer and use it in GitHub Desktop.
Make all string based enums String convertible using the rawValue
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 CustomStringConvertible where Self: RawRepresentible, Self.RawValue == String { | |
var description: String { | |
return rawValue | |
} | |
} | |
extension CustomDebugStringConvertible where Self: RawRepresentible, Self.RawValue == String { | |
var debugDescription: String { | |
return "\(self)" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment