When Tim Cook took to the stage this year it was the first time in WWDC’s history where Apple dedicated a third of the event to talking about the new developer features in OS X and iOS during the keynote. Cook called it "the mother of all releases for developers" and no one can say he was exaggerating. By the end of the keynote Apple had announced over 4,000 new APIs for iOS.
But the thousands of new APIs weren’t the thing that generated the most excitement among developers. The announcement that garnered literal screams of elation from the crowd was when Craig Federighi, Apple’s senior vice president of Software Engineering, walked onstage with a big grin on his face and announced Swift, the company’s new programming language that has been secretly in development for years. Federighi said Swift "totally rules." But does it? We talked to some prominent developers to find out.
Befitting its name, it didn’t take long for coders to launch into creating test apps using Swift. One of the first people out the gate was Nate Murray, cofounder of Fullstack.io, creator of the popular Game for Cats (not humans) and an early employee at IFTTT. Instead of the "Hello World" message programmers traditionally use to test a new system, Murray created a Swift implementation of Flappy Bird, the frustratingly addictive mobile hit which did the rounds earlier this year.
"It took me about four hours to read the e-book on programming Swift and put it together," he says. "I put out a tweet right before I went to bed just to share it with a few friends and it blew up. That tweet [got] almost 500 retweets." Less than 24 hours later, the news had already amassed 2,700 stars on GitHub.
"Swift is surprisingly fantastic, especially for a language that's been developed in secret for years," he continues. "It has the functional programming features that folks like the Ruby community will like, coupled with performance features lower-level programmers demand. And [it’s] fast—surprisingly fast, even to compile."
This point is one that is echoed across the developer community.
"My first impression is that it is a fun, clean language to work with that should result in easier-to-read, shorter code," says Keith Blount, the developer behind acclaimed writing software Scrivener. "The introduction of the ability to have multiple return values from functions is particularly welcome. In Objective-C, if I want to, say, create a function that tells me the most commonly used font in a document and how many times it is used—and maybe also whether it is used in more than half of the text—I either have to have separate functions or create extra pointer parameters, which results in some pretty clumsy and ugly function or ‘method’ names. That’s going to be much more elegant in Swift."
For Blount and for many coders like him, the simplicity of Swift syntax (and its ensuing speediness) is one of its most valuable qualities. For example, to create a record of people’s favorite numbers would look something like this in Objective-C:
NSDictionary *favoriteNumbers = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInteger:7], @"Jane", [NSNumber numberWithInteger:21], @"Bob", [NSNumber numberWithInteger:99], @"Sarah", nil]];
That same code in Swift would actually be far more straightforward:
var favoriteNumbers = ["Jane": 7, "Bob": 21, "Sarah": 99]
While the Objective-C line won’t make much sense to non-coders, the Swift line is quickly comprehensible to anyone. "More readable code is more maintainable code," Blount says.
"Swift will be a powerful new way to quickly develop certain classes of feature or entire apps," says Till Schadde, CEO of equinux, the Apple Design Award-winning company behind VPN Tracker, Mail Designer Pro, and Spot Maps. "We hope that it will be possible to speed up some standard aspects of app development that are currently still quite time-consuming. By eliminating things like memory management issues and other common pitfalls, Swift should also help to increase overall app stability and quality."
"Coding is the new literacy" is a phrase that has resonated through the halls of various departments of education around the world in the last few years. It’s not just hyperbole either. The number of programming jobs is only thought to grow in the coming years, so it’s important to get younger people into coding. To that end Swift will likely be a valuable tool in ushering in a new wave of developers, many of whom will bring fresh ideas to the party.
In this space, he thinks Swift will be a marked improvement.
"We hope that Swift’s easier learning curve and safe programming model will allow our students to focus more on creating great user experiences and UIs, and spend less time on battling with the intricacies of Objective-C and write less boilerplate code," he says.
Of course, a valid question is whether or not an easier barrier of entry is going to be viewed as a positive by established developers in an already crowded app marketplace. While Apple benefits financially from the 1,206,899 apps (and counting) currently in its iOS App Store, established programmers may well feel different. However, Rishi Modha, director of FIPLAB, says that this fear is overrated.
"Whilst Swift may encourage more developers to start writing apps for Mac and iOS due to a lower barrier to entry, I think the impact of greater competition for established market players who are already developing top-quality applications will be negligible," he says.
Sustained success in tech demands a long-term vision, and while lower barriers of entry might mean a slew of new app makers entering the frame, in the long haul a stronger developer community will be better for everyone.
As for users, is Swift likely to make an impact? Sort of.
"As developers get up to speed with Swift, they'll be able to build better products by writing code faster and more efficiently," Modha says. "However, the end user impact from this may not be immediately obvious for anything other than games and resource intensive applications." When all is said and done, the real impact of this year’s WWDC may wind up being some of the "value added" features Apple has incorporated into iOS 8, such as Widgets, Extensions, and the seamless Handoff switching between devices.
"It’s hard to be objective (no pun intended) about a new language when you have hundreds of thousands of lines of code in the existing language," says Keith Blount. "My hope is that Objective-C will continue to be supported for years to come, so that developers with large and complex apps such as myself can transition gradually. Although Swift looks exciting, converting an extensive, mature, and stable codebase written in Objective-C is not something that can be done overnight. So as much as I’m enjoying learning it, I’m also dreading implementing it—which is why I’m very glad that Objective-C and Swift files can sit side-by-side in the same app."
No wonder Craig Federighi looked so happy at WWDC.
[Image: Flickr user Keng Susumpow]