Last active
August 11, 2017 16:48
-
-
Save ncreated/9c5838fe80f229e67f20e0a47947a2b8 to your computer and use it in GitHub Desktop.
Medium blogpost snippet
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
extension ToggleValue { | |
var value: Bool? { | |
switch self { | |
case .initial(let value), .updated(let value), .fallback(let value): | |
return value | |
case .unknown: | |
return nil | |
} | |
} | |
var isInitial: Bool { | |
switch self { | |
case .initial: | |
return true | |
default: | |
return false | |
} | |
} | |
var isFallback: Bool { | |
switch self { | |
case .fallback: | |
return true | |
default: | |
return false | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment