Chapter 19 — Conclusion and further reading
The whole model on one page
flowchart TB
subgraph L1__1__How_do_I_express_async_work___ [\"1. How do I express async work?\"]
A["async / await
(suspend, don't block)"] T["Task
(the unit of work)"] SC["structured concurrency
(async let, task groups)"] CONT["continuations & AsyncStream
(bridge the old world)"] end subgraph L2__2__How_do_I_protect_shared_state___ [\"2. How do I protect shared state?\"] AC["actors
(serialized access)"] MA["@MainActor / global actors"] RE["reentrancy discipline
(re-check across await)"] end subgraph L3__3__How_does_the_compiler_prove_it_safe___ [\"3. How does the compiler prove it safe?\"] SEND["Sendable
(what may cross)"] ISO["isolation & sending
(who touches what)"] S6["Swift 6 checking
(no races compile)"] end L1 --> L2 --> L3
(suspend, don't block)"] T["Task
(the unit of work)"] SC["structured concurrency
(async let, task groups)"] CONT["continuations & AsyncStream
(bridge the old world)"] end subgraph L2__2__How_do_I_protect_shared_state___ [\"2. How do I protect shared state?\"] AC["actors
(serialized access)"] MA["@MainActor / global actors"] RE["reentrancy discipline
(re-check across await)"] end subgraph L3__3__How_does_the_compiler_prove_it_safe___ [\"3. How does the compiler prove it safe?\"] SEND["Sendable
(what may cross)"] ISO["isolation & sending
(who touches what)"] S6["Swift 6 checking
(no races compile)"] end L1 --> L2 --> L3
The ideas that carry everything
The progression you followed
- async/await — write asynchronous code that reads sequentially.
- Tasks & cancellation — launch it, and stop it when it stops mattering.
- Structured concurrency — run independent work concurrently, safely bound to scope.
- Bridging — bring the callback world (continuations) and streams (
AsyncStream) into the model. - Actors — protect shared mutable state without locks, minding reentrancy.
- Isolation &
Sendable— understand who touches what and what may cross. - Swift 6 & 6.2 — turn on the proof, and enjoy the approachable defaults.
Where to go next
- Swift Async Algorithms — the
swift-async-algorithmspackage adds the operatorsAsyncSequenceis - The
Synchronizationmodule —MutexandAtomicfor the low-level cases where an actor is too - Custom executors — advanced control over where actor code runs, for specialized performance or
- Distributed actors — the actor model extended across process and network boundaries, for
- Server-side Swift — concurrency shines on the server; frameworks like Vapor are built on it, and
- The Swift Concurrency Migration Guide — the official companion to Chapter 14, with a deep catalog of
A closing note
What we covered in this book
- Part I — Foundations of async/await: what concurrency is,
async/awaitas suspension (Fetchr), - Part II — Structured Concurrency:
async let(CityDashboard), task groups with bounded concurrency, - Part III — Actors & Isolation: actors (ImageCache), the reentrancy trap and in-flight dedup,
- Part IV — Swift 6 & the Real World: adopting strict data-race checking, Swift 6.2's approachable
Mental model to take away
- Concurrency is three layers: express work (async/await, structured concurrency), protect state
- Four ideas carry all of it:
awaitsuspends (never blocks), structure beats scattering, - The Swift 6 model doesn't make concurrency easy — it makes it honest: the hard parts fail at compile