Last year, Apple introduced Swift, a new programming language that is used with the Xcode development environment to target iOS (mobile) devices and OS X (Mac) computers. We developers were rather excited about this announcement, as it represented a more modern way to create mobile software than the old Objective-C language offered.
Still, not all problems with the Apple development ecosystem have been solved. A large part of programming is knowing the resources that are available when confronting a development problem. Usually, the source is Stack Overflow. Consulting the vast knowledge of our population is often the best way to be efficient while maintaining a broad scope of skills from which to draw.
However, when developing on this new language, Swift, I have found that Stack Overflow does not have enough questions and answers to help with anything but those entry-level tutorial scenarios, especially when programming for the Mac OS X operating system. For cases where it did have good related content, it was usually outdated, because Xcode’s Interface Designer changes so frequently.
Free User-Friendly Software Checklist
In the last ten years, we've created hundreds of SUPER user-friendly applications that our customers LOVE to use. Our secret? We follow these 7 simple guidelines. Sign up to receive your FREE copy of our checklist now.
The content just barely misses the mark, either it is Objective-C code for the Mac environment (which you can translate to Swift) or it is Swift code for the mobile environment. The difficulty stems from the difference between the imported libraries UIKit (mobile) versus AppKit (Mac). For UIKit, classes are typically prefixed with UI, like UIViewController. With AppKit, they are typically prefixed with NS, like NSViewController. When you see an example with UIKit, you can try to simply swap out the prefixes and hope the code works, but that’s not usually the case. The libraries are similar but the classes have slightly different functionality.
With that in mind, here are some resources that can help those learning Swift development and targeting the Mac OS X. This post was written when the newest version of Xcode was 6.4.
The Swift Programming Language – this eBook can be downloaded free from iTunes and is a good reference for the fundamentals of Swift programming.
Swift for Beginners – Develop and Design – this book does a decent job of targeting both platforms (iOS and OS X)
Cocoa Programming for OS X: The Big Nerd Ranch Guide – this is a much more focused guide toward Swift development on OS X
Xcode Playground Projects – allow quick prototyping of Swift code in a clean environment
Cocoa with Swift: Essential Training – A very well-organized video course from Lynda.com
Using Storyboards for OS X – a short video about the User Interface
There are many more resources, but this list should give you the basics. You can Google the rest. Good luck and if this is your first foray into Apple programming, you should learn to read (and translate) Objective-C code!