Swift 4.0 vs. Swift 4.2


Alex Zavatone
 

A few weeks ago, I was updating our apps from Swift 4.0 to Swift 4.2. In the meantime while I was on vacation our team has still been implementing code targeting Swift 4.0. As a result, there are some problems that appear in Swift 4.2

While Xcode has the project updated from 4.0 to 4.2, is there any option to manually select files for migrating/updating from Swift 4.0 to swift 4.2?

Thanks in advance.
Alex Zavatone


Quincey Morris
 

On May 3, 2019, at 11:39 , Alex Zavatone via Groups.Io <zav@...> wrote:

While Xcode has the project updated from 4.0 to 4.2, is there any option to manually select files for migrating/updating from Swift 4.0 to swift 4.2?

I don’t know of a way. What I usually do in this situation is just make sure the build setting is set to the new Swift version (4.2 in this case), then build the project. Then I go through the errors and warnings manually, applying the fixits (which make the same changes that conversion would). It’s theoretically possible that this would miss or mess up some conversions, but the changes from 4.0 to 4.2 (or 4.2 to 5.0) are typically straightforward enough that this isn’t a problem.

If I had lots of files to fix up, I might try adding a new target to the project (or create a new project), and add the unconverted files to the new target. Then set the build setting to version 4.0 and run the conversion on the target. YMMV if the unconverted files depend on files that have already been converted.