Avoiding Force Unwrapping in Swift
The Force is only good in Star Wars
You might hear that Force Unwrapping is bad and should be avoided at almost any cost. So what is Force Unwrapping, and why is it important?
Oh, and this has nothing to do with the Force. I hope nobody gets confused, or if there are confusing Star Wars images within this article.
Difficulty: Beginner | Easy | Normal | Challenging
Prerequisites:
- Be able to produce a “Hello, World!” iOS application (guide HERE)
Terminology
Compiler: A program that converts the high-level computer program that you write in Xcode, and translates these instructions into machine-code or lower-level form which is executed by the computer
Data Types: The format in which a variable or constant stores data
Optionals: Swift introduced optionals that handle the absence of a value, simply by declaring if there is a value or not. An optional is a type on it’s own!