Swift optional variable assignment with ??

Swift optional variable assignment with ??

Old way:

Pretty nifty. I saw this online someplace. The ?? is called a nil coalescing operator. It’s used to provide a default value when unwrapping an optional type.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.