It's easy wrapping to the optional value and it comes from Swift Proposal: SE-0024
infix operator ??=
func ??=<T> (lhs: T?, defaultValue: T) -> T {
guard let lhs = lhs else {
return defaultValue
}
return lhs
}
let text: String? = nil
let newText = (text ??= "Default new text") // Then the newText will eqaul "Default new text"