Skip to content

Instantly share code, notes, and snippets.

@saniul
Created November 1, 2014 05:41
Show Gist options
  • Save saniul/d429c9d0114e4fed6108 to your computer and use it in GitHub Desktop.
Save saniul/d429c9d0114e4fed6108 to your computer and use it in GitHub Desktop.
Corrected NSHipser RawOptionSetType Xcode Snippet
struct <# Options #> : RawOptionSetType {
var rawValue: UInt = 0
init(nilLiteral: ()) { }
init(rawValue: UInt) { self.rawValue = rawValue }
static func fromMask(raw: UInt) -> <# Options #> { return self(rawValue: raw) }
static func fromRaw(raw: UInt) -> <# Options #>? { return self(rawValue: raw) }
func toRaw() -> UInt { return self.rawValue }
static var allZeros: <# Options #> { return self(rawValue: 0) }
static var None: <# Options #> { return self(rawValue: 0b0000) }
static var <# Option #>: <# Options #> { return self(rawValue: 0b0001) }
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment