Getting Latest Version of Swift

Solution 1:

Latest Swift comes with Xcode 11.5 which should run on Catalina. So go to the app store and download the latest version of Xcode.

Solution 2:

You can use swiftenv to easily manage your Swift verisions. You can get it from here.

Solution 3:

https://swift.org/download/#releases

  • Download Xcode 11.5 and the swift toolchain from the above link.

  • Install the toolchain which is in the form of .pkg and will install the toolchain in /Library/Developer/Toolchains. However, if you manually build a toolchain, you can also instal it to ~/Library/Developer/Toolchains.

  • Open Xcode app menu > "Toolchains" options will appear and select the new toolchain.

For console use, run export TOOLCHAIN=swift. This will remain the same for that complier window. If you need it permanently add that line to your bash/zsh profile file and reopen Terminal.

If you built the toolchain manually, prepend the path to swift executable to the PATH variable.

https://swift.org/getting-started/#installing-swift

https://github.com/apple/swift#building-swift