Skip to content

Instantly share code, notes, and snippets.

@atetlaw
Last active September 3, 2016 04:46
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 atetlaw/d4165eb09f6240ec5027278477783e13 to your computer and use it in GitHub Desktop.
Save atetlaw/d4165eb09f6240ec5027278477783e13 to your computer and use it in GitHub Desktop.
Bumblebee operator ~% for getting rawValue from any RawRepresentable enum
prefix operator ~% {}
prefix func ~%<E: RawRepresentable>(e: E) -> E.RawValue {
return e.rawValue
}
@atetlaw
Copy link
Author

atetlaw commented Jul 22, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment