![]() Code will fail gracefully when try to access optional variable with nil value, no runtime error will be triggered. ![]() In this section, we will look into the basic concept and ways we can use to access value of optional type, mainly optional binding and forced unwrapping. The best example of implicitly unwrapped optional type are the IBOutlets you created for your view controller. Set variables as implicitly unwrapped optional type only when you are not able to initialize the variables during its class or struct initialization, but you are confident that the variables will not be nil for its entire lifetime after being initialized.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |