rothwell.im

by Jonathan Rothwell

[LINK] Adventures in Swift: a first (trivial) app

My logical first step when learning Cocoa, and the new Swift programming language, was to begin with Apple’s ‘tutorial’ for Cocoa, a very simple Mac app that consists of a slider and nothing else.

That tutorial doesn’t have a Swift equivalent yet (and even if it did, it would almost certainly be under NDA.) The good news is that, at least in an app like this, Swift literally is a drop-in replacement for Objective-C. I didn’t have to write a line of Objective-C1 nor use bridgeToObjectiveC().

I’ve published my implementation on GitHub. Although I had a few stumbling blocks (mainly because I hadn’t read the documentation on optionals properly) the process of writing the baby slider app was mostly pain-free.

  1. This is just as well, since Objective-C has been the thing putting me off Cocoa development for a very long time.