Developers

Apple Gives Open Source a Swift 2 Kick

Apple this week announced Swift 2 and said it would open-source it later this year. Swift 2 is a programming language for iOS, OS X and watchOS. It has a new error-handling model. Two new features in Objective-C -- nullability annotations and generics -- make Swift 2 work better with Apple SDKs. Swift is "a modern language where memory management is internalized," said IDC's Al Hilwa.

Apple this week announced Swift 2 and said it would open-source it later this year.Swift 2 is a programming language for iOS, OS X and watchOS.

It has a new error handling model that works with Apple SDKs and NSError. Two new features in Objective-C — nullability annotations and generics — make Swift 2 work better with Apple SDKs.

“Generating higher-quality code is the central problem in software engineering, and anything that helps developers do that will help,” said Al Hilwa, a program director at IDC.

Swift is “a modern language where memory management is internalized,” he told LinuxInsider. “Having features that further reduce errors and allow writing of cleaner, more readable code is always welcome.”

Hot New Stuff

The most important new features in Swift 2 include increased performance and improved optimization, as well as a new exception-based error handling system that features “throw,” “try” and “catch” keywords, like Java and other languages, noted Bill Weinberg, senior director of open source strategy at Black Duck Software.

Others are use of the “#Available” keyword to discover properties of the underlying OS, easier transition across OSes and versions, and new platform-optimized SDKs — primarily for current Apple devs.

A Linux port is slated to appear later this year. Key attributes devs should look out for, according to Weinberg, include choice of IDE, if any; support for Android; completeness of the port compared to Swift’s native implementation under OS X and iOS; and volume of platform-specific code. [*Correction – June 11, 2015]

FOSSing Swift

Apple will release Swift 2 to open source under an OSI-approved permissive license. It will contribute ports for OS X, iOS and Linux at launch, and source code will include the Swift compiler and standard library.

Using the permissive license “would make Swift friendly to many commercial entities, but could also make it easier to fork the project and the language,” Black Duck’s Weinberg told LinuxInsider. “Community voices are already singing the praises of Apple’s move.”

Swift is among the top 25 programming languages, and open-sourcing it “will reduce friction to adoption by ushering the language into other platforms,” Weinberg said.

Linux “is a logical target” for Swift, because “it’s the platform of choice for new development, and where other next-generation languages were born, and where they’re percolating today,” Weinberg noted, in addition to being “a close sister operating system to OS X.”

How open-sourcing Swift will impact the nascent Phoenix project, an attempt to implement the Swift spec as open source without the benefit of Apple’s purview, remains to be seen.

“Will Phoenix developers come over to an open source Swift project?” Weinberg wondered. “And what skills and resources will they bring?”


*ECT News Network editor’s note – June 11, 2015: We have removed the following incorrect passage from our original published version of this story: “Several changes make Swift 2 more Windows-friendly. Packages are built in Microsoft Installer’s ‘msi’ format instead of NSIS as before, and sysadmins now can deploy files with policies for configuration options. Swift 2 uses appropriate algorithms when run on a Windows platform locked down in FIPS-140-2 mode. Apple has changed Swift’s TLS provider to Schannel on Windows, which allows Swift 2 to use certificates from the Microsoft CryptoAPI.” Thanks to our reader, testinguser, for bringing this error to our attention.

Richard Adhikari

Richard Adhikari has written about high-tech for leading industry publications since the 1990s and wonders where it's all leading to. Will implanted RFID chips in humans be the Mark of the Beast? Will nanotech solve our coming food crisis? Does Sturgeon's Law still hold true? You can connect with Richard on Google+.

1 Comment

Leave a Comment

Please sign in to post or reply to a comment. New users create a free account.

Related Stories
More by Richard Adhikari
More in Developers

LinuxInsider Channels