I’m about a week into learning iOS and Swift 2.0 and I am pleased and impressed. For reference, I’m using this course (currently $59 on StackSocial).
This week, I went through the basic Swift language sections and lessons about creating a basic app to demonstrate controls, outlets, and actions. I am pleased at how Swift looks so natural and unsurprising – I have to admit that I looked iOS a couple years ago and a page of Objective-C was enough to make me turn around and leave.
For background, I programmed in Pascal as a kid, then C and C++ in college (which I hated), then C# for my first 5 years of work (which I loved), then Ruby/Rails/JS/web for the next 5 years (which I currently love), with Common Lisp and Clojure sprinkled over the last several years for fun. Ruby is my goto language for getting things done, but Clojure is inspiring for its clarity of design and how it guides you to do the right thing. Swift has nice, comforting C-style syntax while providing a lot of the guidance, protection, and convenience that I like about Clojure. For instance:
- the way you have to opt into nil using Optional types
- the way you can save some boilerplate where possible using the forcible unwrap operator
- using guard instead of if to emphasize your main logic
- the flexibility around parameters – binding a local variable with the param name, explicit inout params when you need to change them, variadic parameters
I tend to program defensively and I get the feeling Swift will make that very natural.
I had more fun using the Storyboard, view controllers, and control library than I’ve had in a long time. My first work as a programmer was building Windows Forms in .Net 1.1, and it was so fast and productive for such a rich app experience. I love the web, but no web programming I’ve ever done (even now in 2015) has that same rush of creating results as fast as you can click and type as I got from using Visual Studio way back when. But building a silly toy app that lets you click buttons to change background colors and show/hide controls when you toggle a switch was every bit as good. I know there’s so much more to iOS than the control library, but if the rest of the platform is a well developed and simple to code against as that, then I’m in for a real treat!
Next up are an Ad Libs app and an RGB app.