Created
June 13, 2017 21:11
-
-
Save xxtesaxx/33eafee20b8f39deab5e51a0343aa49b 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 | |
extension Optional where Wrapped: Emptyable { | |
static func ???(left: Wrapped?, right: Wrapped) -> Wrapped { | |
return left.orWhenNilOrEmpty(right) | |
} | |
} | |
let optionalString: String? = nil | |
let mandatoryString = optionalString ??? "Default Value" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment