Created
March 2, 2020 11:11
-
-
Save patka817/1aee94abd725140e849aa947741c24a8 to your computer and use it in GitHub Desktop.
Operator for optional assignment
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 ?= : AssignmentPrecedence | |
public func ?= <Value>(lhs: inout Value, rhs: Value?) { | |
if let rhs = rhs { | |
lhs = rhs | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment