Downloads for Swift

These are the downloadable files for Swift for Dummies and Swift Playgrounds. The code has been updated to Swift 1.2 (and Xcode 6.3) but separate files for Swift 1.1 (and Xcode 6.2) are also downloadable in their own archive.

The 1.2 code  is basically the same as the code shown in the book, but a number of uses of as have been changed. Most have been changed to as! and a few have been changted to as?. The simplest way to look at this change is that it tightens up the use of as so that

  • as! may fail
  • as? may return a nil value

You can download the files separately for each chapter or in one archive. (Not all chapters have downloadable code.)

Also note that curly or smart quotes should be changed to straight quotes in the code in Chapter 4. The downloadable code is correct.

Please note a correction on page 101. Change

let newManagedObject =

  NSEntityDescription. insertNewObjectForEntityForName("Event",

  in ManagedObjectContext: context) as NSManagedObject

to

let newManagedObject =

  NSEntityDescription. insertNewObjectForEntityForName("Event",

  in ManagedObjectContext: context) as Event 

 

Tags: