Created
October 1, 2014 05:34
-
-
Save muukii/9e7fab33a4f0e685d5de to your computer and use it in GitHub Desktop.
Swift bit
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
private struct FavoritesModelConnectingType: RawOptionSetType { | |
private var value: UInt = 0 | |
init(_ value: UInt) { | |
self.value = value | |
} | |
// MARK: RawOptionSetType | |
static func fromMask(raw: UInt) -> FavoritesModelConnectingType { | |
return self(raw) | |
} | |
// MARK: RawRepresentable | |
static func fromRaw(raw: UInt) -> FavoritesModelConnectingType? { | |
return self(raw) | |
} | |
func toRaw() -> UInt { | |
return value | |
} | |
// MARK: BooleanType | |
var boolValue: Bool { | |
return value != 0 | |
} | |
// MARK: BitwiseOperationsType | |
static var allZeros: FavoritesModelConnectingType { | |
return self(0) | |
} | |
// MARK: NilLiteralConvertible | |
static func convertFromNilLiteral() -> FavoritesModelConnectingType { | |
return self(0) | |
} | |
static var FavoritesList: FavoritesModelConnectingType { return self(1 << 0) } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment