New Swift, Core Data and Cocoa BooksMay 16, 2016 · 6 minute read · Comments
There have been so many good iOS and Cocoa books published over the last year that I thought it was long overdue that I updated by bookshelf with some new recommendations. Here are six books I bought in the last year covering Swift, Core Data and even one for OS X that may interest you.
Swift Programming: The Big Nerd Ranch Guide (1st Edition)
Authors: Matthew Mathias and John Gallagher
Published: Dec 15, 2015
Website: Big Nerd Ranch
The free Apple guide to the Swift Programming Language is a good starting point but if you want a little more guidance you cannot go wrong with The Big Nerd Ranch (BNR). This is a thorough coverage written in the easy to read style of all BNR books. It makes good use of playgrounds with frequent exercises to test your understanding.
The five sections cover getting started, the basic language, collections and functions (and closures), enumerations, structures and classes and the difference between value and reference types. A section on advanced Swift covers protocols, error handling, extensions and generics. The final section looks briefly at an OS X and iOS application and Objective-C interoperability. This is a book about learning Swift though so if you want to learn iOS you need to look elsewhere.
Note: This book uses Swift 2.0 and Xcode 7.0 and inevitably there will be further changes when we get Swift 3 later this year.
objc Advanced Swift
Authors: Chris Eidhof and Airspeed Velocity
Published: Mar 18, 2016
If you have been using Swift for a while and want to dig a little deeper this book is an excellent next step. If you read any of the objc.io articles published monthly up until May 2015 you will have some idea what to expect. This book picks up where the introductory books stop and explains how and when to make use of the advanced features of Swift.
The book has chapters covering Collections, Optionals, Structs and Classes, Functions, Strings, Error Handling, Generics and Protocols. The book ends with an example of wrapping a C library and interoperability.
objc Functional Swift
Authors: Chris Eidhof and Airspeed Velocity
Published: Oct 1, 2014
This book is an interesting companion to the earlier two books on Swift. It will not teach you Swift but it will teach you how to think functionally when writing Swift. It is hard to learn Swift without seeing mention of functional programming. The authors try to demystify the topic and show how the ideas can help you write better code.
What I like about this book is that the authors go easy on the terminology. So there is a chapter on functors and monads but it is at the end of the book and not fundamental to understanding. Instead they introduce topics with a series of case studies that show for example why avoiding mutable state can lead to better code. Highly recommended once you have the basics of Swift under control.
objc Core Data
Authors: Florian Kugler and Daniel Eggert
Published: Dec 22, 2015
You know how it is, you wait for ever for a new book on Core Data and then two come along together. The first is again from objc.io and given the other books they have published it will not surprise you that they make extensive use of Swift language features such as generics, protocols and extensions when using Core Data.
The book introduces Core Data through an example app before deep diving into the framework. The third section is an interesting look at the difficult topic of synching Core Data with a network service like CloudKit. Finally they cover some advanced topics such as searching, sorting and performance.
Core Data in Swift
Author: Marcus Zarra
Published: June 15, 2016
Pragmatic Programmers has taken an interesting approach with the latest update to a favourite book on Core Data. The trend seems to be for new books to use only Swift and abandon Objective-C. Here you get to choose from a third edition of the book Core Data in Objective-C or a new edition Core Data in Swift.
The content for both books is the same the only difference is the language used for the example code. You can read my previous review of the second edition. This version covers changes for iOS 9 and OS X El Capitan and is still an excellent introduction to Core Data. Step by step Marcus walks you through building a Core Data application - the sample code is available for download. As with the second edition the focus is iOS first with a chapter towards the end on how to add a desktop version.
This book is still in beta as I write this with a planned June publication date.
Cocoa Programming: For Mac OS X (5th Edition)
Authors: Aaron Hillegass, Adam Preble and Nate Chandler
Published: Apr 14, 2015
Website: Big Nerd Ranch
The last few years has seen an explosion of books on iOS and now Swift so it is great to see The Big Nerd Ranch giving Cocoa development on the Mac some much needed love. If you are an iOS developer who is curious how to create a Mac application this book should help.
The book has lots of examples and exercises to walk you through the core techniques for building Mac apps. Many of these concepts, like Auto Layout and Storyboards will be familiar to iOS developers. The content and code examples assume OS X Yosemite (10.10), Xcode 6.3 and Swift 1.2 (there are three chapters covering the basics of Swift) but I had no problem trying the examples with Xcode 7 and Swift 2.2.
If you are looking for help to develop your first Mac application this is a great book to get you started.
Which Should You Buy?
There are so many books on iOS and Swift development that it is impossible to read them all. Having said that I liked all these books so here is a quick guide to help you decide if they will help you:
New to Swift? If you want something more than the free Apple guide you are spoilt for choice. I have always liked the Big Nerd Ranch teaching style and I think their Swift book is a great starting point.
Learnt some Swift but want to go deeper? Once you have the basics of Swift mastered the two books by objc.io on Advanced Swift and Functional Swift are highly recommended. They offer a bundle if you want to get both.
Struggling with Core Data? Either book on Core Data will do a good job teaching you the framework and best practises. The choice between them is one of style. I find Marcus Zarra’s book a little easier to get started with but the objc.io one is the more Swifty of the two if that is a consideration.
Want to get into Mac development? Finally if you have always wanted to give Mac development a try and did not know where to start try the BNR guide. There is far less choice for Mac developers when it comes to up-to-date books so it is great to see The Big Nerd Ranch has not forgotten the Mac.