1 / 11
Move from GCD, completion handlers, and Combine to modern Swift concurrency and Swift 6 data-race safety: async/await, tasks and cancellation, async let and task groups, AsyncSequence and AsyncStream, actors and reentrancy, @MainActor and isolation, Sendable, region-based isolation and sending…
async/await, Tasks, Actors, Sendable, and Swift 6 Data-Race Safety in Real Apps
Read before you buy: the PDF here is a free sample — the first 20 pages of the 462-page book (payments, sales and reviews on this demo site are sample data). Get the full e-book at thenexbooks on Gumroad.
Stop fighting the compiler's concurrency errors — understand the model behind them and write race-free iOS code with confidence.
Most iOS codebases live in two eras at once: dispatch queues, completion handlers, delegates, and Combine on one side, async/await on the other. Then the Swift 6 language mode arrives and asks questions about actors, isolation, and Sendable that nobody on the team can quite answer. This book gives you the mental model first — which isolation domain runs this code, where the suspension points are, who owns this state — and then the code, so the diagnostics start making sense.
Written for working iOS developers, it does not re-teach Swift or SwiftUI basics. Instead you rebuild the concurrency layer of one realistic app step by step, starting from the callback-based code many teams still have and finishing with a tested, Swift 6-clean architecture.
What's inside
- Why structured concurrency replaces GCD: task trees, automatic cancellation, and compile-time data-race checking
- async/await in depth: suspension points, async properties, error handling, and what can change across an await
- Bridging legacy code: checked continuations, turning delegates into AsyncThrowingStream, and Combine and NotificationCenter interop
- Tasks, priorities, detached tasks, task-local values, cooperative cancellation, cancellation handlers, and a reusable timeout helper
- async let and task groups for fan-out, partial failure, and limiting concurrency
- AsyncSequence and AsyncStream: buffering policies, termination, single-consumer streams, and broadcasting
- Async patterns: retry with exponential backoff, debounce, polling, and the open-source Swift Async Algorithms package
- URLSession's async APIs: requests, status handling, streaming bytes line by line, and downloads
- Actors, reentrancy, actor API design, an actor-based concurrency limiter, @MainActor, global actors, and isolation in depth
- Sendable, @Sendable closures, Mutex, region-based isolation, and the sending keyword
- The Swift 6 language mode: enabling it, reading its diagnostics, and fixing each category correctly
- Approachable concurrency in recent Swift versions: default main-actor isolation, nonisolated(nonsending), and @concurrent
- A step-by-step migration of a legacy GCD "manager" singleton to Swift 6
- Concurrency in real app layers: SwiftUI .task and .refreshable, @Observable models, Core Data, SwiftData model actors, and background refresh
- Caching with in-flight deduplication, live updates, and alerts
- Testing async code with Swift Testing and XCTest, debugging with Instruments and Thread Sanitizer, and performance without guesswork
One running example, start to finish. You build the concurrency core of Skyvale, a fictional weather dashboard that combines readings from three weather providers and one air-quality provider for six cities. It has to cope with slow sources, a source that never answers, stale readings, retries, rate limits, caching, live streams, air-quality alerts, offline data, and background refresh — plus a legacy module written with dispatch queues that you bridge and then migrate. The app runs in a Demo data mode with fixed sample readings and simulated latency, so every number in the book can be checked by hand.
Current and honest. The book targets the Swift 6 language mode with Xcode 26-era tooling and an iOS 18 deployment target; iOS 26-only APIs are marked with availability checks, and the newest Swift features are clearly labeled. Compiler messages are paraphrased because their wording changes between releases, timings are simulated rather than invented benchmarks, and there are no made-up statistics. Every chapter includes Swift code, Tips, Notes, Warnings, exercises, and Key Takeaways, and the appendices give you a cheat sheet, copy-ready templates, a production checklist, and a glossary.
Format: PDF, 462 pages (A4), linked table of contents and bookmarks. English. First Edition, 2026. Published by thenexbooks. Requires a Mac with Xcode to run the examples. Apple, iOS, Xcode, Swift, and SwiftUI are trademarks of Apple Inc. This book is independent and is not affiliated with, sponsored by, or endorsed by Apple Inc.
Table of Contents
Part I — Foundations of Swift Concurrency
- Ch 1 · Why Structured Concurrency: From GCD and Completion Handlers to async/await
- Ch 2 · async/await in Depth: Suspension Points, Async Functions, and Errors
- Ch 3 · Bridging Legacy Code: Continuations, Delegates, and Combine
- Ch 4 · Tasks: Creation, Priorities, Detached Tasks, and Task-Local Values
- Ch 5 · Cancellation: Cooperative Checks, Cancellation Handlers, and Timeouts
Part II — Structured Concurrency in Practice
- Ch 6 · async let: Running a Fixed Number of Operations Concurrently
- Ch 7 · Task Groups: Dynamic Fan-Out, Partial Failure, and Limiting Concurrency
- Ch 8 · AsyncSequence and AsyncStream: Modeling Values over Time
- Ch 9 · Async Patterns: Retry, Backoff, Debounce, Polling, and Async Algorithms
- Ch 10 · Networking with URLSession's Async APIs: Requests, Streaming Bytes, and Downloads
Part III — Actors and Isolation
- Ch 11 · Actors: Protecting Mutable State Without Locks
- Ch 12 · Actor Reentrancy and Designing Actor APIs
- Ch 13 · The Main Actor and Global Actors: Keeping UI Code Correct
- Ch 14 · Isolation in Depth: nonisolated, Isolated Parameters, #isolation, and Executors
- Ch 15 · Sendable: What Can Safely Cross Isolation Boundaries
Part IV — Swift 6 Data-Race Safety
- Ch 16 · Region-Based Isolation and the sending Keyword
- Ch 17 · The Swift 6 Language Mode: Strict Checking and Reading Diagnostics
- Ch 18 · Approachable Concurrency: Default Main-Actor Isolation, nonisolated(nonsending), and @concurrent
- Ch 19 · Migrating a Legacy Codebase to Swift 6, Step by Step
Part V — Concurrency in Real Apps
- Ch 20 · SwiftUI and Concurrency: .task, @Observable Models, and Refresh
- Ch 21 · Core Data and SwiftData with Concurrency
- Ch 22 · Background Work: App Refresh, Scene Phases, and Long-Running Transfers
- Ch 23 · Caching, Deduplication, and Live Updates: The Skyvale Aggregation Engine
Part VI — Quality and Production
- Ch 24 · Testing Async Code with Swift Testing and XCTest
- Ch 25 · Debugging Concurrency: Instruments, Thread Sanitizer, and Logging
- Ch 26 · Performance: Contention, Main-Thread Hops, and the Cooperative Thread Pool
- Ch 27 · Concurrency Architecture: Dependencies, Error Strategy, and Team Guidelines
- Ch 28 · Case Study: Shipping Skyvale under Swift 6
Appendices
A · Swift Concurrency Cheat Sheet
B · Templates and Reference
C · Production Checklist
D · Glossary
Book details
| Detail | |
|---|---|
| Pages | 462 |
| Format | PDF (A4) |
| Language | English |
| Level | Intermediate to Advanced |
| Edition | 1st Edition (2026) |
| Download on this site | Free sample, first 20 pages (PDF) |
| Publisher | thenexbooks |
Files you get
No reviews yet. Only buyers can review.
More from thenexbooks