If you are using Tuist with Swift 5 and want to adopt Swift 6, you might need to make some changes to your project to get everything working. The following discussion in Slack prompted this topic, which aims to capture all necessary changes.
View in #support on Slack
@Keke_Arif : How would I fix this for Swift 6? Is there a migration guide?
@Marek_Fořt: There’s this PR that does the same changes you can do. But I hope we can get around this.
For our models, we can add Sendable
conformance, but I’m a bit surprised that Package
causes issues as well
We could probably add extension Package: Sendable {}
but it feels wrong. @Mike what do you think?
#6738 fix: Manifests Packages module build error when using Swift 6
@Keke_Arif : yeh that’s how I fixed it too…
@Pedro : @Marek_Fořt could it be that the PackageDescription
module bound to version of the tools swift-tools-version:5.10
don’t conform to sendable? I wonder what’d happen if we bump that version instead to 6.0
@Mike : yes, this is due to the toolchain version at the beginning of the file
folks either need to @preconcurrency import PackageDescription
or use a version that’s annotated (which i believe 6.0 is)
PackageDescription version whose models don’t conform to Sendable
If you get is not concurrency-safe
when editing the Package.swift
of your project. You can either:
Update the // swift-tools-versions:5.xx
to // swift-tools-versions:6.0
to the latest version to consume models that are concurrency-safe.
Import the models with @preconcurrency import PackageDescription
We recommend the former, but note that you might need to go through some breaking changes introduced in the PackageDescription
models.