10.5 · Region-based isolation, sending, and migrating to Swift 6
Swift 6 turns data races from a debugging session into compile errors. The language gives you three tools for crossing boundaries safely: Sendable, regions and sending.
Mental model. A data race needs shared mutable state across domains. The compiler proves that either nothing is shared, or nothing is mutable, or someone is in charge.
Crossing boundaries
Region-based isolation and <code>sending</code>.
- How does region-based isolation work, and what does the sending keyword add on top of Sendable?
Plain Sendable is a type property: “values of this type are safe to share”, and most classes are not. That was too strict: passing a freshly created object to…
Migrating
Adopting strict concurrency in a real app.
- How do you migrate an existing app to Swift 6 and strict concurrency without breaking it?
Swift 6 mode turns the concurrency checks that were warnings into errors, so you migrate in steps instead of flipping a switch. The checking level can be…
More in Concurrency
- 10.1 · Queues, QoS, barriers, groups, semaphores and sources
- 10.2 · Operation, OperationQueue, dependencies and cancellation
- 10.3 · async/await, tasks, task groups, cancellation and task locals
- 10.4 · Actors, reentrancy, isolated, nonisolated, global actors and @MainActor
- 10.6 · Continuations and bridging GCD, Combine and callback APIs
- 10.7 · Deadlocks, main-actor hops, Thread Sanitizer and Instruments
- 10.8 · Task groups, async let, cancellation and task locals in practice
- 10.9 · Isolation rules, isolated parameters, global actors, main-actor hops and default isolation
- 10.10 · Sendable rules, locks versus actors, and the escape hatches
- 10.11 · Groups, semaphores, parallel loops, operation dependencies, QoS and timers
- 10.12 · AsyncStream buffering, continuation misuse and notifications as async sequences