Understanding Swift: for C and C++ Programmers while having to learn as little Object-C as possible by David Francis Curran

Understanding Swift: for C and C++ Programmers while having to learn as little Object-C as possible by David Francis Curran

Author:David Francis Curran [Curran, David Francis]
Language: eng
Format: azw3
Publisher: D F Curran Productions
Published: 2016-01-10T16:00:00+00:00


You will get an error asking you to unwrap MyInt(rawValue:0)

Fixing it will add a !

Lets go back and look at:

var myNewBubble = MyInt( rawValue: 3)

again. This does NOT need a ! to unwrap it. As its value is nil and unwrapping it would create an error.

(Figure 13.11 There is no 3 so unwrapping it causes an error.)

Next we will try

var myNextNewBubble = MyInt(rawValue: nil) //Fails saying the expected value after rawValue has to be an Int.

So keep in mind with an enum like



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.