My Thoughts on Swift

During this year's WWDC, Apple announced Swift, an "innovative new programming language for Cocoa and Cocoa Touch". This caused quite a frenzy, and I think it is for good reason. The feature set, full of buzzwords, got everybody in the room excited. On top of that, the demos hinted at the new workflow and style of programming that Swift enables. Personally, I'm glad Swift "happened", even though it targets a "closed silo". This post tries to illustrate why.

In case you missed the keynote, here's a wordcloud with the (main) features of Swift:

Swift features

From the language design perspective, Swift is similar to other modern languages, like Scala. Among the main features, its memory management model focuses on safety (no overflows, segfaults etc.), it compiles to native code so it's fast, and it favors writing concise, expressive code through the use of type inference, pattern matching and higher order functions. These are all great things and I'm sure that all the research people are now on PTO, partying, happy to see that all the "geeky" things that they worked on are now used in (what is to become) a mainstream programming language.

It's also great to see that Apple has done what was needed to ensure a smooth transition, making Swift compatible with existing Objective-C code and all their frameworks. My feeling is that Swift will become at least as popular as Objective-C is today. Some will adopt it out of pragmatism, others out of hipsterism, some maybe just out of curiosity. This userbase will probably get the language to be as popular as Objective-C is today.

However, because of the other aspect that I'm going to discuss next, the workflow, I think that Swift might appeal to first-time programmers and maybe even people who hadn't considered programming before. It's these people that could take adoption rate further, making it an even more popular programming language.

For me, the big change that Swift brings is its interactive playground.

Swift interactive playground

You can see a demo of the playground during the last 15 minutes of the WWDC keynote. The main idea is that you can visualize what your code does live, as you write it. Even more, you can track back the state of your app over time, allowing for new ways of debugging.

The concept is in no way new, and people like Bret Victor (Inventing on Principle) and, later on, Chris Granger (Light Table) have talked about it for a while now. Also, the Elm guys have something similar in their debugger. What's crazy is that people were experimenting with things like this in the 70s! However, none of the current-day examples are something that fits "the masses", a tool that you can give to anybody and right off the bat make them productive.

To me, Swift changes that. Together with all the frameworks and guides Apple has available, people with plenty or no programming experience can start working on things and get instant feedback. I think this is key to making programming less "misterious" and getting more people into it. Think of it like Scratch, but for real world use.

With Swift out, I really hope that other programming communities will take note and try to find a way to take their own workflows to the next level. Because as cool as Swift is, it's a tool only for Apple's ecosystem.

Mihnea Dobrescu-Balaur

Building @Hootsuite Analytics. Interested in Open Source, programming languages and the Open Web. Big fan of basketball and photography. Tweet @mihneadb.

Bucharest, Romania

Subscribe to Mihnea DB

Get the latest posts delivered right to your inbox.

or subscribe via RSS with Feedly!