Begrudgingly, Swift

by Louis Tur

I used to dislike Swift.

Turns out, I really only hated Swift because of the way it was being taught. For some perspective: I spent months learning the in's & out's of Objective-C's verbose beauty, it's endearing quirks, and its welcoming community. Coding in ObjC was like building with Lego bricks: there was a defined mechanism to how pieces could interlock, but with that simple mechanism you could build anything you wanted...like a 1:1 scale model of an X-Wing

Objective-C has a fairly rigid semantic structure that makes it easy to know what to expect, perhaps at the cost of flexibility. But in that rigid structure, everything is spelled out for you in the most beautifully obvious way possible... block syntax being the exception. I kind of think of Objective-C like some obscure 17th-century English text in some ways - it's structured using very defined syntactical and semantic rules, and although its written in English you won't understand it well enough without knowing its lexical nuances.

Then there's Swift which, if Objective-C is a 17th-century English text, is like an iMessage conversation. The focus is on brevity to communicate a bevy of information while having an autocorrect safety net. What would take a paragraph to explain in the 17th century is distilled into an emoji. And yet, somehow we get so much more out of that single emoji.


Swift is pretty O.K.

I recently started up on Stanford's Winter 2015: Developing iOS 8 Apps with Swift taught by Paul Hegarty through iTunesU. After having gone through just the first three lectures posted, and completing the first assignment, I already have a much deeper appreciation for Swift than I had gotten from reading the official Apple documentation and doing some random tutorials. If Objective-C is building with Legos, Swift is probably building something using anything and everything you could find in an art supply store.

And that kind of flexibility and expressiveness in brevity makes it feel as though Swift is some intangible mess of iMessage acronyms and emoji strings. Though, the turning point was watching an entire method shortened into a single statement. I made sure to document this metamorphosis thoroughly:

It was a lot to digest all at once. But I sat there and dealt with it. I'm looking forward to seeing what else Swift can do.

Louis Tur

"How" has been the single most used word in my literary arsenal for as long as I can remember. I've never really been satisfied knowing that something works, but only by knowing how it works.

Read more from this author