I\'m using Xcode 6 Beta 4. I have this weird situation where I cannot figure out how to appropriately test for optionals.
If I have an optional xyz, is the correct w
Also you can use Nil-Coalescing Operator
The
nil-coalescing operator(a ?? b) unwraps an optionalaif it containsavalue, or returnsadefault valuebifaisnil. The expression a is always of an optional type. The expressionbmust match the type that is stored insidea.
let value = optionalValue ?? defaultValue
If optionalValue is nil, it automatically assigns value to defaultValue