With the new iPhone 7 Apple has released the iOS 10 operating system and with it comes Xcode 8 and a new version of the Swift language for the iOS developer community.
Swift 3.0 is an open source language that has been developed by the community together with Apple Engineers.
One of the great things about developing an open source language is that everybody can see the evolution of the language and inspect the code. In the official release notes there is a list of all the changes that have been implemented in the new Swift version.
Swift 3.0 is also the first release to include the Swift Package Manager, a tool for managing the distribution of Swift code trough dependencies.
Top 10 changes in Swift 3
1.- Import Objective-C Constants as Swift types
2.- Consistent first argument labels
4.- Better translation of Obj-C APIs
Functions And Closures
5.- Closure parameter names and labels
6.- Remove the ++ and – operators
Good Looking C
7.- Import as member
8.- Modernizing Swift’s Debugging Identifiers
9.- Modernized dispatching
API Design Guidelines
10.- Removing ‘NS’ prefix
The ‘NS’ prefix from key Foundation types is getting removed in Swift 3.
See SE-0086 – Drop NS Prefix in Swift Foundation.
For those who want to read more about it: Apple has released a free book about the Swift Programming Language (Swift 3 beta) on their iBook store.
Migrating from Swift 2.2
Swift 2.2 unfortunately is not supported with Xcode 8 anymore. This means that you will need to migrate your current projects to Swift 3.0 if you want to compile them with the new Xcode.
The problem is that all the 3rd party libraries need to have the same version as your Swift project. And some of them may not be ready yet.
In order to make the transition smoother, Apple is still supporting Swift 2.3 in Xcode 8. Swift 2.3 is almost identical to 2.2.
How to migrate?
Xcode 8 includes a migration tool in order to “help” with the process. A reality check revealed that after using the tool you will end up with a list of warnings that you will have to fix manually.
There is a good article by Jesse Squires on how to migrate libraries from Swift 2.2 to Swift 3.0 that I highly recommend.
Chris Lattner, a senior director of the Developer Tools Department at Apple, posted a lengthy note to the Swift mailing list today that looks back at the development of Swift 3.0 and sets some expectations for Swift 4.0 next year.
Apple is planning to release two major Swift updates next year. Swift 3.1 in spring and Swift 4.0 in Fall 2017. For the development of Swift 4.0 there will be two stages. During stage 1 Apple would like to focus on source and ABI stability first, and then move on to other features in stage 2 depending how much extra time there is.
To read more about Swift, visit swift.org
This post was originally post in Liip blog.