Trouble working with Swift Development Snapshots in Xcode

I've downloaded and installed the Xcode version of the Swift 5.7 snapshot from June 13 and set the TOOLCHAINS environment variable such that invoking swift --version in a newly opened Terminal instance gives me this:

Apple Swift version 5.7-dev (LLVM fc0ab39bda0c879, Swift c6bb52ea2e91c0e)
Target: arm64-apple-macosx12.0

I've also selected the snapshot toolchain in Xcode 13.4.1 (13F100) so that the About screen shows "Swift 5.7 Development Snapshot 2022-...".

However, when I create a Swift package in Xcode and try to set // swift-tools-version: 5.7 in Package.swift, I get an error: package '[packagename]' is using Swift tools version 5.7.0 but the installed version is 5.6.0.

Am I missing a step or doing something incorrectly, or is the inability to work with these snapshots in current release versions of Xcode documented somewhere?

Toolchains don’t replace the integrated SPM feature of Xcode. You’ll want to use the Xcode 14 betas if you want 5.7 compatibility.

1 Like

Thanks, @Jon_Shier, I suspected that might be the case.

Given that, I'm now curious - what does configuring a different Xcode toolchain actually allow you to do that you otherwise could not? Anyway, Xcode beta here I come! Thanks again :slight_smile:

It gives you the compiler and other tools like LLVM and LLDB built as part of Swift. However, it doesn't replace anything built into Xcode itself, such as the SPM integration (which you saw) or the SwiftUI canvas compiler (for some reason that's a completely different instance of the compiler with different settings and bugs). There are probably other bits but those are the big ones.

1 Like

What would be a typical example of something that someone might want to use this setup to build?