What this thread does
Do first: compile in -swift-version 5 -strict-concurrency=complete to expose isolation problems before switching local and CI builds to the strict language mode.
Short answer
As of November 2026, this recipe uses the language-mode behavior documented for the Swift 6.4 toolchain release, September 15, 2026 and current migration guidance. Complete data-race safety checking can be enabled as warnings using -strict-concurrency; Swift 6 language mode enables full data-race safety checking (migration guide). Fix ownership and isolation before increasing severity; suppressing diagnostics cannot synchronize shared mutation.
Choose / don't choose
@MainActor: choose for UI state and APIs whose callers can share main-actor isolation; don't use it for unrelated long-running computation (language guide).- A dedicated actor or immutable value: choose for non-UI shared state or transferable snapshots; don't transfer a mutable reference that still has unsynchronized aliases (common problems).
@unchecked Sendable: choose only for an audited type whose every mutable access is already protected; don't add it merely to silence a crossing failure. Mozilla's July 18, 2025 mock-state report records the practical risk.
Not for: SwiftUI mutation during view updates; see swiftui-publishing-changes-from-within-view-updates-warning-fix.
Settings that matter
| Setting or flag | Value / default | Applies to | Source |
|---|---|---|---|
-strict-concurrency | complete enables complete concurrency checking for swift or swiftc | Current Swift migration docs; linked toolchain release | guide |
| Swift language mode | Swift 5 during warning cleanup; Swift 6 for full data-race safety checking; use the same mode locally and in CI | Linked toolchain release; current guide | mode |
SWIFT_STRICT_CONCURRENCY | complete in Xcode/xcconfig for warning migration | Current Xcode migration guidance | settings |
SWIFT_VERSION | 6 when enabling strict language mode in Xcode; select deliberately per target | Current Xcode migration guidance | settings |
@MainActor | Require an annotated function to run on the main actor | Current language docs | isolation |
Order of operations
1. Align compiler and mode in local and CI logs. Slava Pestov's December 9, 2024 example distinguishes complete-checking warnings from strict-mode errors; severity alone does not show that state became safe. 2. Locate each boundary and every alias of the non-Sendable object. Pass a value snapshot, move ownership into an actor, or consistently isolate the owner and API. If an external lock is essential, audit both reads and writes before declaring unchecked conformance (common problems, Mozilla report). 3. Keep invariant-changing updates in synchronous actor-isolated methods. await Task.yield() suspends the current task and allows other tasks to execute. Yield may also immediately resume the same task, so it is neither a barrier nor a guaranteed ordering primitive (yield API.md), actor invariants). 4. After warning cleanup, select -swift-version 6 consistently and address remaining errors at their ownership boundary (migration guide).
Known failures and fixes
| Error (short quote) | Cause | Fix | Source |
|---|---|---|---|
has non-sendable type | A Sendable-conforming owner retains a nontransferable reference | Make the value transferable, isolate it, or prove external synchronization | ConfusedVorlon discussion, common problems |
| Mutable mock state uses unchecked conformance (report) | Mutable state declared @unchecked Sendable | Isolate compatible mocks or protect every access | Mozilla report |
| State assumption changes after yield (symptom) | Actor method calls may overlap (reentrant code) | Restore invariants before await and revalidate upon return; keep atomic updates synchronous | language guide, yield.md) |
Missing
- A safe synchronization mechanism depends on all access paths and protocol requirements. Main-actor isolation cannot be imposed on a synchronous nonisolated protocol requirement without adapting the contract.
Checked
2026-11-12; linked Swift release, migration/language sources, yield API, dated Swift discussion and Mozilla report read. No Swift build or race-detection run executed.
Started from a post by @Swift project, packaged by the editor. Original post