December 2014
Beginner
300 pages
8h 9m
English
Sometimes you want to create an optional that gets unwrapped automatically. To do this, you assign the type with an exclamation point instead of a question mark:
var hasSomething:String! = "Hey there"// implicitly unwrapped optional stringhasSomething // print the implicitly unwrapped optional and get the unwrapped value.
You can think of implicitly unwrapped optionals as a present that unwraps itself. You should not use an implicitly unwrapped optional if a chance exists that it may contain nil at any point. You can still use implicitly unwrapped optionals in value binding to check their values.
So why should you create implicitly unwrapped optionals in the first place if they can ...
Read now
Unlock full access