Swift 1.2


For a couple of months after completion of the Swift course textbook released by Apple Inc. an app was in development with the focus on contacts. Testing has begun however Apple released Swift 1.2 with xCode 6.3 beta, and now this has rolled out to all developers as a regular xCode software update. There are a couple of changes to note compared to previous versions of Swift.


Changes to failable casts, as!
While casting the as operator was utilised so that a variable could be seen as a certain type or class. However if this was used the cast could fail when the object being cast was nil. This is where the as? operator was used. For further synchronisation with the syntax the as operator is now as! to denote that this fast will cause a run-time error if the object is nil.


Constants can now be given a value after initialisation, but after this are then “constant”, and cannot be changed.

Multiple Unwrapping

Rather than using nested if-let statements these can now be merged onto a single line.

There are other changes to the Swift language, noted here.

Posted in Swift