What does "unwrap" a number mean?


In the iPhone lessons you refer to “unwrap” when dealing with numbers. What does this mean?


It’s related to Optional Types.

When you see a ? after a type name, that means the variable is an Optional Type.

That means it can have a value or it can be undefined (nil).

Some conversion methods can fail, so sometimes they will return a valid value, or they will fail and return nil (nothing).

You unwrap these optional type values to work with them, using the if/let syntax you can safely use a value, protecting you from running code that could crash if nil was returned instead of a value.

Read more: http://www.touch-code-magazine.com/swift-optionals-use-let/