Apple Open Sources Swift

Apple is open sourcing the latest version of its year-old Swift programming language, the company announced at its World Wide Developer Conference (WWDC) in San Francisco this week. Apple's senior vice president of Software Engineering, Craig Federighi, made the announcement and got a standing ovation from conference attendees.

"We think Swift is the next big programming language," he said, "the one we will be doing application and systems programming on for 20 years to come. And we think Swift should be everywhere and used by everyone. So today, we're doing something really big: We're making Swift open source."

Launched at last year's WWDC, Swift is the successor to Apple's Objective-C. It sheds the "baggage of Objective-C," the company said at the time, to provide "an innovative new way of coding for Cocoa and Cocoa Touch." Where Objective-C relies on defined pointers, the Swift compiler infers the variable type. But it keeps such features as well-defined namespaces, generics, and operator overloading.

Swift 2 is aimed at developers building apps for iOS, OS X, and watchOS. Apple plans to release it under an OSI-approved permissive license. The company will contribute ports for OS X, iOS, and Linux at launch, and the source code will include the Swift compiler and standard library. Apple made the developer beta available this week. A public beta is expected in July, followed by a free upgrade roll out in the fall.

Apple has been rolling performance upgrades to language since it was launched--"Stepping on the gas," Federighi said.) He also Federighi pointed to a new optimization technology in Swift 2 called whole module optimization. The list of improvements in this release includes better error handling, unified keyword naming rules for functions and methods, protocol extensions and default implementations, and extended pattern matching. And developers will also be able to see interface headers synthesized in Xcode.

But it was news that Apple would be open sourcing Swift 2 that brought down the house. Why did Apple open source its fledgling language?

"Swift is being open sourced because Apple wants to accelerate adoption and broaden the language reach to more than its own platforms," said IDC analyst Al Hilwa. "Apple is realizing the degree to which open source has become a prerequisite for developer adoption and appears to be shifting its strategy accordingly. Having Swift in open source begins the process of ecosystem building, a process that has helped Java significantly in recent years."

Federighi said that "a flood of apps" written in Swift have been coming into the app store. And there's other evidence that Swift is has been gaining traction among mobile app developers, fast, and at the expense of its predecessor. According to TIOBE Software's latest Programming Community Index, "Objective-C is going into freefall," TIOBE's researchers write, losing about 1 percent of market share per month. "If this trend continues, Objective-C will leave the TIOBE index top 20 before the end of this year," they said. Swift topped Stack Overflow's most recent "Most Loved" list, with 77.6 percent of developers who are developing with the language expressing interest in continuing to develop with it.

Apple has said the new language will be able to co-exist alongside existing Objective-C files in the same project.

About the Author

John K. Waters is the editor in chief of a number of sites, with a focus on high-end development, AI and future tech. He's been writing about cutting-edge technologies and culture of Silicon Valley for more than two decades, and he's written more than a dozen books. He also co-scripted the documentary film Silicon Valley: A 100 Year Renaissance, which aired on PBS.  He can be reached at [email protected].