Lim Thye Chean
Lim Thye Chean

Reputation: 9434

Convert from Swift 3.x to 5

When I opened my project in Xcode 10.2, I got this message:

Unsupported Swift Version …Use Xcode 10.1 to migrate the code to Swift 4.

Where can I still find Xcode 10.1? So the process is to have 2 versions of Xcode, first migrate to Swift 4 then 5?

PS: If I migrate the code to Swift 5, does the app still bundle Swift binary? If yes, then what's the benefits since the app still bundle Swift binary? If no, then how does it handle iOS 11.x?

Upvotes: 8

Views: 14701

Answers (2)

Lance Samaria
Lance Samaria

Reputation: 19592

I just ran into this problem with an old Cocoapod file that is written in Swift 3 but my Xcode supports Swift 5. There is no need to download Xcode 10.1. I followed this Apple Forums answer which works fine.

1- When you open project, you get this alert:

enter image description here

2- Select OK and open Issues Navigator (press command button + 5). It's the blue triangle icon

enter image description here

3- Find the yellow triangle warning for project, click each one, then when the alert appears validate changes when requested.

enter image description here

4- You should then get a compilation error, with Swift version undefined:

enter image description here

5- In the Project Navigator (left pane), select the blue project icon:

enter image description here

6- Select Build Settings and make sure that underneath of it, it's set to All and Combined

enter image description here

7- In the right search bar enter Swift Language. The result should say Swift Language Version - Unspecified:

enter image description here

8- Just click Unspecified and change it to Swift 5

enter image description here

9- In the 8th pic above, on the left side the TARGETS section is on the first target that says Audio Mixer Demo. You're gong to have to do the same thing to Audio Mixer DemoTests because it's also initially set to Unspecified. The Swift Language for that is going to need to change to Swift 5.

10- Fix all the red errors that are going to appear

Upvotes: 1

Oscar
Oscar

Reputation: 391

You need to redownload Xcode 10.1 from this page, convert your code to Swift 4, then redownload Xcode 10.2 and convert to Swift 5.

The only other option I can think of is changing your Swift Version in your apps bundle and then seeing if it lets you convert but I don't think it will.

Upvotes: 13

Related Questions