Ready for Swift 6
The Swift 6 language mode prevents data races at compile time. When you opt into Swift 6 mode, the compiler will produce errors when your code has a risk of concurrent access, turning hard-to-debug runtime failures into compiler errors.
To track the progress of the Swift package ecosystem, the Swift Package Index is running regular package compatibility checks across all packages in the index.
For help migrating your project's code, see the Swift 6 language mode migration guide.
Total packages with Swift 6 zero data race safety errors
This chart shows packages with zero data race safety compiler diagnostics during a successful build on at least one tested platform.
Total Swift 6 data race safety errors
This chart shows the total number of all data race safety diagnostics across all packages.
Frequently asked questions
Q: What is a “data race safety error”?
A: Swift 6 introduces complete concurrency checking, a compiler feature that checks your code for data race safety. The number of data race safety errors reflects how many issues the compiler detected relating to these concurrency or data race checks. The total errors chart plots the total number of these errors summed across all packages.
Q: Are additional parameters added to the build command for these tests compared to the “standard” Swift Package Index builds that determine Swift version compatibility on package pages?
A: Yes. These charts plot the status of packages as if every package had opted in to the Swift 6 language mode and enabled “complete” concurrency checking. We pass -strict-concurrency=complete
to either swift build
or xcodebuild
to achieve this by enabling all data race safety checks in the compiler.
Q: Are packages that show zero data race compiler diagnostics guaranteed to be safe from data race errors?
A: No. We gather data on data race safety from Swift compiler diagnostics with “complete” concurrency checks enabled. We can’t tell if the diagnostics produce zero errors due to a genuine lack of data race safety errors or whether errors have been suppressed using techniques like @unchecked Sendable
.
Q: Why use -strict-concurrency=complete
instead of -swift-version 6
?
A: Data race safety diagnostics are determined in different stages of the compiler. For example, type checking produces some data race safety errors, and others are diagnosed during control-flow analysis after code generation. If type checking produces errors, the compiler will not proceed to code generation, so testing with -swift-version 6
would show fewer errors than really exist across the package ecosystem.
Q: What packages are in the “all packages” data set?
A: We are not testing every package in the index. Instead, we are testing packages that are under some kind of active development. For this test, we define “all packages” in the chart to be any package having at least one commit to their repository in the last year. We took a snapshot of active packages on the 19th of March 2024, and the “all packages” data set includes 3,395 packages. The data set also excludes any new packages added after the 19th March.
Q: What packages are in the “Apple packages” and “SSWG incubated packages” data sets?
A: It’s interesting to look at some slices of curated package lists in addition to overall compatibility. Apple should be leading from the front, so the “Apple packages” data set is all packages authored by Apple, again with the same criteria as above applied. Nothing newer than March 19th and nothing without commits in the last year. The SSWG incubated data set is the same idea but sourced from the Swift Server Workgroup incubated packages list.