Protect shared state in Swift with actors and Sendable
8 steps · about 3 h 10 min · Intermediate
- Data-race safety in Swift 6 (guide, Swift.org Documentation, 25 min)
Start with the mental model of isolation domains, Sendable boundaries and compile-time data-race checking.
- SE-0306: Actors and actor isolation (doc, Swift Evolution, 30 min)
Understand how actors serialize access to mutable properties, cross-actor awaits and actor reentrancy.
- SE-0302: Sendable and @Sendable closures (doc, Swift Evolution, 25 min)
Learn which value types, immutable classes and closures can cross isolation boundaries safely.
- MainActor global actor reference (reference, Apple Swift Documentation, 15 min)
Guarantee UI-bound view models and callbacks run on the main thread via @MainActor.
- SE-0316: Global actors (doc, Swift Evolution, 25 min)
See how global actor annotations propagate across types, protocols and closures.
- SE-0414: Region-based isolation for non-Sendable values (doc, Swift Evolution, 25 min)
Learn how Swift 6 proves a non-Sendable value is safely transferred when it is no longer aliased.
- Solving common Swift concurrency compiler errors (guide, Swift.org Documentation, 25 min)
Work through real diagnostics around protocol conformance, global variables and @unchecked Sendable.
- Incremental adoption of strict concurrency checking (guide, Swift.org Documentation, 20 min)
Enable strict concurrency flags module by module without blocking shipping builds.