Test-Driven Development in Swift, Second Edition
Updated and revised for Swift Testing and modern Swift development.
I haven’t written in a while, and a self-promotion email might not be what you were expecting, but the second edition of Test-Driven Development in Swift just hit the shelves and I would be a terrible author if I didn’t tell you about it.
When the first edition shipped in 2021, we wrote tests with XCTest and asynchronous code with Combine. But the Swift landscape is always evolving and improving. Between Swift Testing and async await, the way we write and test code has changed. This edition is a full revision to match.
What’s new
Swift Testing throughout. Every test in the book is now written with Swift Testing and making the most of its natural language support. But fear not, if your codebase still runs on XCTest, a new appendix holds a completed XCTest reference, so you can bridge the book’s lessons to your older tests.
Structured concurrency. The networking chapters have been rewritten with async/await. The old AnyPublisher<T, Error> signatures are now async throws -> T, and the tests await results directly instead of using cumbersome XCTestExpectation or sink.
A refreshed sample app. Alberto’s menu-ordering app now uses the latest SwiftUI APIs and look and feel. Chapter 7 keeps @Published/ObservableObject as the teaching path and adds a sidebar on where @Observable fits.
Get it
Grab a copy from Apress or Amazon, and pick up the free bonus material while you’re at it.
If you already own the first edition
The Test-Driven Development philosophy hasn’t changed, because it was never tied to a framework. The menu-ordering app, the Test Doubles (Stub, Spy, Fake, Dummy), and the red/green/refactor rhythm are all still here.
What changed is the how: Swift Testing, structured concurrency, modern SwiftUI. If you’re moving a codebase onto those, the second edition is a guided tour of the new patterns in context.
Questions about the new edition? Leave a comment below, find me on X, or at gio@mokacoding.com.


