Skip to content
SwiftMind
swifthigh impactReleased 2024-09-16

Swift 6.0 — data races become compile errors

The release the whole concurrency model was built toward. In Swift 6 language mode, code that could race is rejected at compile time rather than crashing intermittently in production.

new

Swift 6 language mode enforces complete concurrency checking

Opt in per module. Sendable violations and cross-actor access that were warnings in Swift 5 mode become errors. This is the single largest source of migration work in a mature codebase, and it is deliberately opt-in per target so you can move one module at a time.

What to do

Enable complete concurrency checking in Swift 5 mode first and clear the warnings. Only then switch the module to Swift 6 mode.

new

Typed throws

A function can declare the concrete error type it throws with throws(MyError). Useful in constrained code and generic algorithms that need to propagate an error type precisely; ordinary application code is usually still better served by untyped throws.

Affects