Last active
November 7, 2017 18:52
-
-
Save JadenGeller/de8aa892eb4a3af0ecf9146c6fc97ad9 to your computer and use it in GitHub Desktop.
Optional Default Raw
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 Optional { | |
subscript (default value: Wrapped) -> Wrapped { | |
get { | |
return self ?? value | |
} | |
set { | |
self = newValue | |
} | |
} | |
} |
Author
JadenGeller
commented
Nov 7, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment