
This will also change the Swift Language Version build setting for the migrated targets to Swift 5. When this is done, you will be presented with all the changes that will be applied once you click on ‘Save’. Targets that do not contain any Swift code will not be selected.Ĭlicking Next will bring up the Generate Preview sheet and the assistant will initiate a migration build to get source changes. You will be presented with a list of targets to migrate. You can be reminded later or invoke the Migrator manually from the menu Edit -> Convert -> To Current Swift Syntax…

When you open your project with Xcode 10.2 for the first time, you will see a migration opportunity item in the Issue Navigator: click it to activate a sheet asking you if you’d like to migrate. If your project depends on other open-source projects that are provided by Carthage or CocoaPods, consult the Using Carthage/CocoaPods Projects section.

To review and modify what is included in the scheme, invoke the Edit Scheme… sheet and select the Build tab from the column on the left, and make sure all your targets and their unit tests are included. The migration assistant does a migrator build to gather the changes, using the scheme you have selected, so the targets that will get processed are the ones that are included in the scheme. While migrating to Swift 5 is definitely encouraged, it’s not an all-or-nothing process, as Swift 4, 4.2, and 5 targets can coexist and link together. You decide when and if you’d like to migrate on a per-target basis when it makes sense for your project. This will allow you to easily review the changes that were applied via the migration assistant and to discard them and re-try the migration if needed.

It’s highly recommended to have your project managed under source control. You may need to resolve errors initially due to compiler changes.

Make sure that the project that you intend to migrate builds successfully in Swift 4 or Swift 4.2 mode, and all its tests pass. Xcode 10.2 comes with a Swift Migrator tool that helps you migrate your project to Swift 5.įor the previous release’s Migration Guide, see Migrating to Swift 4.2.
