Last active
August 29, 2015 14:13
-
-
Save Reflejo/59c6e18532b6ba5f6d45 to your computer and use it in GitHub Desktop.
Simplified version
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
#!/usr/bin/env xcrun swift -O | |
struct MyOptions: RawOptionSetType, BooleanType { | |
var boolValue: Bool { return self.rawValue != 0 } | |
var rawValue: UInt | |
init(rawValue value: UInt) { | |
self.rawValue = value | |
} | |
init(nilLiteral: Void) { | |
self.rawValue = 0 | |
} | |
static let allZeros = MyOptions(rawValue: 0) | |
static let OptionA = MyOptions(rawValue: 0b10) | |
static let OptionB = MyOptions(rawValue: 0b100) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment