Can "-Xfrontend -enable-experimental-concurrency" be enabled in a Package?

Hello, I am looking to learn more about the concurrency pitches/proposals by using the experimental toolchain

  • Implementation: Available in recent main snapshots behind the flag -Xfrontend -enable-experimental-concurrency

I have the toolchain installed and Xcode is aware of it.

I created a simple Swift Package with some simple async code just to play about. Xcode, correctly warned that the features aren't available unless the -Xfrontend flag is passed.

If the Package.swift manifest is altered to include that flag in the SwiftSettings, then Xcode is satisfied and code checking appears to work.

// swift-tools-version:5.3
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
    name: "ConcurrencyExperiment",
    dependencies: [
        // Dependencies declare other packages that this package depends on.
        // .package(url: /* package url */, from: "1.0.0"),
    targets: [
        // Targets are the basic building blocks of a package. A target can define a module or a test suite.
        // Targets can depend on other targets in this package, and on products in packages this package depends on.
            name: "ConcurrencyExperiment",
            dependencies: [],
            swiftSettings: [
                .unsafeFlags(["-Xfrontend -enable-experimental-concurrency"])
            name: "ConcurrencyExperimentTests",
            dependencies: ["ConcurrencyExperiment"]),

However, neither Xcode, nor SPM from the command line appear to be able to build from the package, giving the error:

<unknown>:0: error: unknown argument: '-Xfrontend -enable-experimental-concurrency'%

/Library/Developer/Toolchains/swift-PR-35059-806.xctoolchain/usr/bin/swift build <unknown>:0: error: unknown argument: '-Xfrontend -enable-experimental-concurrency'%

Am I using SPM wrongly here, am I making an obvious error, or should I expect this to work?



Try separating "-Xfrontend" from "-enable-experimental-concurrency" like this
.unsafeFlags(["-Xfrontend", "-enable-experimental-concurrency"])
This works for me atleast with the latest snapshot from


Fabulous, thanks very much!

1 Like