How do I migrate Swift 3 code to Swift 4 in Xcode 10.1. I have a program that was written In Swift 3 a few years ago and haven't updated it for quite a while. I am now using Xcode version 11.2 and when I load this program into Xcode it tells me to use Xc

I have a program that was written In Swift 3 a few years ago and haven't updated it for quite a while. I am now using Xcode version 11.2 and when I load this program into Xcode it tells me to use Xcode version 10.1 and migrate the Swift 3 code into Swift 4 code. I have made several attempts to create Xcode version 10.1 but all have failed for one reason or another.


I downloaded the file Xcode_10.1.xip from Apple Developer but when I tried to unzip the file a message told me that the file was not from Apple and wouldn't unip it.


In another attempt I found an old Xcode_10.1 version in Time Machine and restored it to a copy of Xcode. When I tried to run it a message said that I needed to load some new components into it but when I did that it quit with an unknown error.


If I can't migrate my program from Swift 3 to Swift 4 my program is toast. Can anyone help me?


FredErixon

Xcode 9.0 came with a Swift Migrator tool that helps migrate to Swift 4, however, you'll need to use an older macOS prior to Catalina. See https://swift.org/migration-guide-swift4/


But then you'll want to go from 4 to 5 - seen this recent thread?

Re: How to install Xcode 8 on Mac Catalina

Change the system date a few month back just to get time to open.


Then immediately restore the correct date, to avoid creating a big mess in time machine for instance.

Yes I did restore the correct time. Thanks.

FredErixon

Great. Don't forget to close the thread.

Actually, 2 ways:
  1. Download Xcode 10.x from Developer website, try multiple versions. Automatically migration.

  2. Change Swift version to 4 or 5 in Project Build Settings. Then manually fix all the errors.

This is the hell with developing in Swift. Need to upgrade some old project for latest iOS? Ok, you need the latest XCode. But ... oops, you need to upgrade Swift language version. Ok, no problem, XCode should be able to do that. But, oops, you need older XCode version to do that. Ok let's download that older one. Oops, older XCode is not compatible with current macOS version. Need machine with older macOS version ...

How do I migrate Swift 3 code to Swift 4 in Xcode 10.1. I have a program that was written In Swift 3 a few years ago and haven't updated it for quite a while. I am now using Xcode version 11.2 and when I load this program into Xcode it tells me to use Xc
 
 
Q