Concurrency in Swift (iOS/macOS)
Concurrency in Swift (iOS/macOS)
Summary:
The book "Concurrency in Swift (iOS/macOS)" is a comprehensive guide to one of the most complex yet critically important aspects of Apple development. The author, Alexey Zakharov, a senior iOS developer with 10 years of experience, consistently guides the reader from basic concepts to professional parallel programming patterns.
What is this book about?
The book covers all modern concurrency tools in Swift:
- Swift Concurrency (async/await): a complete immersion into the new asynchronous model, including structured concurrency, Task Groups, and Continuations.
- Actors: protecting shared state from data races through data isolation.
- Grand Central Dispatch (GCD): working with queues, synchronous/asynchronous tasks, and Dispatch Groups.
- OperationQueue: managing dependencies, priorities, and operation cancellation.
- Thread Safety: practices for avoiding deadlock, livelock, and race conditions.
- Testing: writing reliable tests for concurrent code using XCTestExpectation and Actors.
Who is this book for?
- iOS/macOS developers who want to transition from legacy approaches (callback, delegate) to modern async/await.
- Junior and Middle specialists seeking to deepen their understanding of multithreading.
- Team leads and architects designing high-load applications with smooth UI.
What will the reader learn?
After studying the book, you will be able to:
- Write asynchronous code without callbacks and retain cycles.
- Efficiently manage background tasks without blocking the main thread.
- Design thread-safe data models using Actors.
- Optimize application performance using parallel operations.
- Debug and profile concurrent code using Instruments.
The book contains dozens of real-world examples for UIKit and SwiftUI, as well as analyses of common mistakes. It is ideally suited both for self-study and as a desktop reference.
Important: the book is oriented towards Swift 5.9+ and Xcode 15. Basic familiarity with the Swift language is assumed.