Convert from Swift 3.x to 5
Asked Answered
K

2

8

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?

Kimberliekimberlin answered 10/4, 2019 at 1:59 Comment(2)
More Downloads for Apple DevelopersTerrier
migrate the code to swift 5 , change swift language version in build setting your projectPillow
M
13

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.

Millner answered 10/4, 2019 at 2:47 Comment(1)
The link here may be too specific and is more likely to change over time. Better to link to the main page More Downloads for Apple DevelopersTerrier
L
1

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

Lording answered 5/8, 2022 at 18:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.