Created
June 22, 2018 22:28
-
-
Save antonyalkmim/12c29cdfc4f3cc6c4b2d62db1a80bd62 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
infix operator ?!: NilCoalescingPrecedence | |
@_transparent | |
public func ?!<T: OptionalType>(value: T, error: @autoclosure () -> Error) throws -> T.ValueType { | |
if let value = value.optionalValue { return value } | |
throw error() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment