Apple's Swift language, unveiled last June, is perhaps the first brand-new blockbuster technology rolled out in the company's post-Steve Jobs era. Intended to offer a more modern approach for building OS X and iOS applications, the language has grabbed its share of attention, climbing the charts in language popularity indexes and accounting for 340 repos in GitHub as of early this month. Clearly, developers are climbing board the Swift juggernaut, in part because they like what it brings to the table.
"Swift is much easier for beginners to learn than [predecessor language] Objective-C," says Michael Patrick Ellard, an independent iOS developer who teaches classes on Swift at the University of California, Santa Cruz. Fully mastering Objective-C requires developers to learn three different syntaxes: C function, Objective-C method, and blocks, he says. "In Swift, the syntax for functions, methods, and closures is essentially the same, so it's much easier for beginners to read and write code."
Developers appreciate features, Objective-C transition
A developer at application development firm Magenic concurs. "The Swift language is not only easy for the non-programmer to learn, but it's also a fairly easy transition for Objective-C developers," says developer Wendy Wise, a consulting manager at Magenic and an author. "The language itself is also more 'human-readable' than many other development languages and yet provides the power required to accomplish even the most complex functions."
In general, learning any particular feature of Swift is going to be easier [than Objective-C], says Ellard. "That said, Swift has features that Objective-C doesn't have, such as generics, tuples, operator overloading, and type inference. It probably takes as much time to fully master Swift as it does to fully master Objective-C." Wise says Objective-C developers will appreciate carryovers, such as structs and blocks, as well the simplicity and power of enumerators, tuples, and generics.
Swift, says Russ Miller, a mobile solutions architect at Magenic, increases the ability to write apps with immutability. This is especially helpful when working with APIs called by unknown consumers, he adds. Miller also likes generics in Swift: "Generics, which enable developers to avoid duplication by writing flexible, reusable functions and types that can work with any type, are a huge plus."
Right after Swift debuted, some found it to be on the slow side. But Ellard sees Swift as fast enough. "For most tasks that most developers need to do, Swift is fine. In some areas Swift is faster than Objective-C, in some areas it is not as fast, but the differences are not going to be significant for most app developers."
Swift continues to evolve
The language still is evolving, which brings some challenges. "As a product, Swift is still rapidly changing, making it difficult to implement best practices and calling code and architecture durability into question," Miller says.
Developer Christopher Allen, who has a background both in the Mac and iOS, believes Swift had better be on software development road maps. He still stands by statements he first made last summer: "I expect that any serious app started in 2016 will be written in Swift."
But the language is not quite ready, he says. "There have already been significant changes to the language just since the last beta, and many more changes appear to be coming down the pipeline. I think they in the same situation as Google's Go -- they have to get it out and pounded on as soon as possible, but it's only now, two years later, that Go is approaching maturity enough for people to take it seriously."
Wise also points out another aggravating circumstance around Swift, of which Apple cannot necessarily be held accountable. "One of the most annoying things about the Swift language is Google Search -- my first search almost always returns a reference to [singer] Taylor Swift, no matter how carefully I construct my search terms."