pinglock
pinglock

Reputation: 1253

How do I install a newer swift-tools-version?

I'm attempting to create a new Swift package for the first time.

According to this Apple documentation, to create a package with bundled resources I need to be using swift-tools-version:5.3 however my system defaults to swift-tools-version:5.2.

I've checked the Apple Developer downloads portal for related files as well as Apple's SPM repo on GitHub but don't see any direction or guidance on this subject.

I'm running Xcode 11.6 (11E708) on Catalina 10.15.5 (19F101)

Upvotes: 13

Views: 22878

Answers (2)

congnd
congnd

Reputation: 1274

It's bundled within Xcode. If you need swift-tools-version:5.3, you need to use Xcode 12.

The https://xcodereleases.com website is a good resource for understanding the Swift version that is bundled inside each version of Xcode.

Upvotes: 11

multitudes
multitudes

Reputation: 3495

What works for me is:

  • open the last version of Xcode, or download the newest.
  • This will download the latest released Swift version.
  • Apparently there isn't a way to download the keychain separately or I did not find it.
  • then in the settings in Xcode you select the new keychain under command line tools.
  • Back to terminal you can use Swift 5.5 or the newest one!

in the settings

Another possibility

  • Go to Download Swift
    There you can see the releases and the snapshots with the latest Swift toolchains.
  • Download the one for macOS.
  • Once downloaded (around 800MB), double-click to launch the installer, then follow the on-screen instructions. Expect a full install to take up about 3.5GB.
  • go to the Xcode menu in the top-left corner, and choose Toolchains
  • You'll need to restart Xcode and then it will show that you have the latest one in the about Xcode menu.

change the toolchain

Upvotes: 4

Related Questions