How to Convert to Latest Swift 2.0 – Open migration tool Xcode 7
Advertisement
Apple has launched the new Swift 2 programming language for iOS and Mac OS Developers and with it has also launched the new XCode 7. When you launch the new XCode 7, you will get an option of migrating all your old Swift projects (the ones using Swift 1.0 and later but prior to Swift 2.0) to the latest Swift 2.0 programming language. The Swift 2.0 migration dialog looks somewhat like this:
I was not aware of this change earlier and the moment I opened the all new XCode 7.0, I was presented with the migration dialog but I got confused thinking it is the version control dialog and closed the dialog abruptly. Later, I realised that it was the Swift 1.0 to Swift 2.0 migration dialog and wanted to start it again. The migration dialog is available under the Xcode Edit menu: Edit > Convert > More options. Take a look at the screenshot below for more information: However, the migration tool is not as smart as you think and you will have to do some additional cleanups before you can proceed to build the app. After using the migration tool to upgrade to Swift 2.0 for one of my apps, I was presented with 89 new errors. Most of them were related to the latest changes in Swift 2.0 (Must Read) and also about the version checking protocol in Swift 2.0 - with #available and guard #available. The #available protocol is definitely one of the sweetest new features of Xcode 7 that will notify you automatically while you write code as to whether your code is compatible with the build version that you have selected in your App Target settings.Advertisement