Due to Swift cool behaviors I was looking for an or equivalent in Swift.
or
Something like this:
variable = value or default
Use ??:
??
var optional:String? var defaultValue:String = "VALUE" var myString:String = optional ?? defaultValue print(myString)
You could use the nil coalescing operator
let variable = optional ?? default