Addendum for our Swift book
On 8 April 2015, Apple released Xcode 6.3, updating the Swift language to Swift 1.2. We spent some time working through our recent book, Swift Development with Cocoa, to make sure we knew how the changes impacted the example code, and to provide updated code as needed.
We're pleased to say that the required changes are minor! We've pushed a full set of updated example code to the GitHub repository, available here. We've also made a changelog, listing the differences between the code examples in the book, and the current best-practice with Xcode 6.3:
NSApplicationMain(C_ARGC, C_ARGV) has been replaced with NSApplicationMain(Process.argc, Process.unsafeArgv)
Several methods that were implementations of protocols had the optionality of their parameters changed. For example, the applicationDidFinishLaunching parameter originally had a parameter of type NSApplication!, which has now changed to NSApplication.
Several properties changed from being optional to non-optional, or vice-versa.
Swift now has a "forced cast" operator, as!, which is used when down-casting from a class. We've update the code to use as! when appropriate (such as when downcasting from NSObject to CLLocation)
Changed NSCalendarUnit.DayCalendarUnit (which was deprecated) to NSCalendarUnit.CalendarUnitDay
Changed "countElements" to its new replacement, "count".
You can also find the changelog in the GitHub repository. The changes are all very minor, thanks Apple! If you have any questions, don't hesitate to contact us! Thanks for buying our book, we love hearing from readers.