Can someone help me understand the following code expression, how would you read it?
let myVar = (someOptional != nil) ? someOptional! : ""
If someOptional is not nil unwrap it? if this is correct, what does do the ?
and the :""
in the expression?
I have always unwrapped my optionals with if let
s but and I'm not sure how the above code reads.
Here is a more concrete real code example that shows how it is used...
let currentZipCode = (placemark.postalCode != nil) ? placemark.postalCode! : ""