Hi,
I was trying to migrate some packages to swift 6 yesterday.
I ran into a funny detail
We have a project at work with some local SPM packages in Xcode 26 / iOS 18+
I updated my Package.swift to look like
// swift-tools-version: 6.2
import PackageDescription
let package = Package(
name: "Logging",
platforms: [.iOS(.v18), .watchOS(.v11)],
products: [
.library(name: "Logging", targets: ["Logging"]),
],
targets: [
.target(name: "Logging"),
]
)
And it compiled all right.
When I did the same for other packages (with no dependencies), I got some errors requiring to conform to Sendable and so on.
Then I assumed that I was using the Swift 6 language mode, specially since originally, my Package.swift looked like
// swift-tools-version: 6.2
import PackageDescription
let package = Package(
name: "Logging",
platforms: [.iOS(.v18), .watchOS(.v11)],
products: [
.library(name: "Logging", targets: ["Logging"]),
],
targets: [
.target(
name: "Logging",
swiftSettings: [
.enableExperimentalFeature("StrictConcurrency=off")
]
),
],
swiftLanguageModes: [.v5]
)
Then, when running the app on Xcode cloud (on Xcode 26), I see the error
Static property 'logDestinations' is not concurrency-safe because it is nonisolated global shared mutable state
from a file part of the Logging package.
Finally I modified my Package.swift again to be like
// swift-tools-version: 6.2
import PackageDescription
let package = Package(
name: "Logging",
platforms: [.iOS(.v18), .watchOS(.v11)],
products: [
.library(name: "Logging", targets: ["Logging"]),
],
targets: [
.target(name: "Logging"),
],
swiftLanguageModes: [.v6]
)
Now compiling the package scheme in Xcode actually showed me those errors I saw on CI.
But why? I assumed that not specifying the swiftLanguageModes was enough to be fully opt-in in swift 6. Or at least I expected that using swift-tools-version: 6.2
Also why Xcode cloud gave me the error when locally Xcode didn’t?
Finally, I am not sure where I could see the default value of swiftLanguageModes, as in if I don’t pass that value explicitly, what will the compiler use?
A lot of questions, but thanks!