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.
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.
Hmm actually we need to do BOTH Nof them. When removing the @preconcurrency
we get the error:
.../Tuist/Package.swift:33:5 Let 'package' is not concurrency-safe because non-'Sendable' type 'Package' may have shared mutable state
Is there already a plan / PR which aims to make Package concurrency safe?
Cheers