Home > Blockchain >  Swift shows old version even after installed a newer version
Swift shows old version even after installed a newer version

Time:04-03

New to the iOS land.

I am using an old Mac with OS Catalina 10.15.7, XCode 12.4, Swift 5.3.2

I need to use the async function in my Swift project, checked and found that it is only supported since the Swift version 5.5.

So I downloaded the Swift 5.5 from the Swift Download page and double clicked the pkg file to install it.

It showed the installer GUI and I installed it successfully.

Then I closed my terminal and re-opened it again and use this command to check the Swift version:

xcrun swift -version

But it still shows the old 5.3.2.

What steps did I miss?

CodePudding user response:

I think that your old Mac has not the requirements to run 5.5.

See here

https://developer.apple.com/de/support/xcode/

So the least possible Version is shown.

CodePudding user response:

I just found that to use a different installed Swift version in XCode, do this:

  1. Xcode (menu on the top bar)
  2. Toolchains
  3. Voila~ All my installed Swifts are here

So I have

  • Xcode 12,4 (which has Swift 5.3.2)
  • Swift 5.5 Development Snapshot
  • Swift 5.6 Release 2022-03-08

Here is the article which helps me: https://www.shawnbaek.com/posts/how-to-use-an-older-version-of-swift-on-xcode-12

  • Related