Last active
September 3, 2016 04:46
-
-
Save atetlaw/d4165eb09f6240ec5027278477783e13 to your computer and use it in GitHub Desktop.
Bumblebee operator ~% for getting rawValue from any RawRepresentable enum
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
prefix operator ~% {} | |
prefix func ~%<E: RawRepresentable>(e: E) -> E.RawValue { | |
return e.rawValue | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I was tired of having to call
rawValue
on all my enums when I wanted to use their raw values in arguments and variable assignments.