Apple Swift 2.0 Open Source - programming features

Posted on : Tue, 9th Jun 15 11:44 am UTC
2314 votes

Swift 2.0

Apple announced the new version of Swift at WWDC 2015 - Swift 2.0.
The new version has improved performance, new error handling API, first-class support for availability checking, platform APIs feel even more natural in Swift with enhancements to the Apple SDKs.

Here is a list of all new features which make Swift 2.0 so great -

Open Source

Swift will now be made open source (later this year).
Swift source code will be released under an OSI-approved permissive license. Compiler and standard libraries for iOS, OS X, and Linux will be out by end of year.

Error handling model

New error handling model in Swift 2.0 will instantly feel natural with familiar try, throw, and catch keywords.
Designed to work perfectly with the Apple SDKs and NSError. NSError conforms to a Swift’s ErrorType.


Latest SDKs ensures access to new features and information about platform changes.
The Swift compiler now shows an error when you use an API that is too new for your target OS, and #available blocks can safely wrap lines of code to only run when on the right OS versions.

Protocol extensions

Swift is very focused on protocol-oriented development. Swift 2.0 adds protocol extensions, and the standard library itself uses them extensively.
Where you used to use global functions, Swift 2.0 now adds methods to common types so functions chain naturally, and your code is much more readable.

Swift-er SDKs

Swift 2.0 works even better with the Apple SDKs, thanks in part to two new features in Objective-C: nullability annotations and generics.
The SDKs have been updated to annotate API that cannot return nil so you don’t need to use optionals as often. And with a true generics system employed by the SDKs you can more often preserve detailed type information in your Swift 2 code.

So all developers, get ready for some cool new development features for your iPad, iPhone, iPod, Mac.

Code2care's mission is to share varied knowledge in technical and non-technical areas gathered during day-to-day learnings and development activities so that our visitors can leverage this portal to find solutions to their queries without re-inventing the wheel. Technical posts include Learnings, Tutorials, Video Tutorials, Code Snippets, Tips-n-tricks.

Follow us : Facebook - Twitter - Google +