Shape Shape point chapter-list Group Group Group Group Group Shape Copy 12 Shape Shape Copy 3 Shape Shape dropdown editor editor Combined Shape grid Shape Copy 4 Shape Copy 7 Shape language language Shape megaphone paperback Shape platform noun_419259-2 copy play-icon Group BS-Question-Rounded-Circle quotes noun_610406 stacked-books-1 stacked-books-2 Group Group Group Group Group Group Group Group Group Path

Combine: Asynchronous Programming with Swift

$59.99 4.2/5 34 reviews · Write a Review
  • Platform iOS 13
  • Language Swift 5.1
  • Editor Xcode 11

The best book to master declarative asynchronous programming with Swift using the Combine framework!

The introduction of Combine into the Swift ecosystem now gives you a native way to manage asynchronous events in Swift, meaning you don’t have to rely on third-party reactive frameworks for event-driven systems.

Developer Guide


For Intermediate Developers

Master declarative asynchronous programming with Swift using the Combine framework!

Writing asynchronous code can be challenging, with a variety of possible interfaces to represent, perform, and consume asynchronous work — delegates, notification center, KVO, closures, etc. Juggling all of these different mechanisms can be somewhat overwhelming. Does it really have to be this hard? Not anymore!

With Apple’s introduction of the Combine framework in WWDC 2019, it is clear that Apple aims to position declarative and reactive programming in Swift as a long-term investment and a game-changer in how developers perform and compose pieces of asynchronous work, making it a must-have tool at your disposal.

The introduction of Combine as a built-in framework in Apple’s ecosystem is promising news to developers who were interested in frameworks such as RxSwift or ReactiveSwift, but didn’t want the overhead of a third-party dependency; and while experience with either of the above could be useful, it is not a prerequisite for this book. You’ll learn everything from the ground up to become a true Combine master.

What Is Combine?

Combine is Apple’s framework to work with asynchronous events in a unified and reactive way that ensures your app is always up to date based on the latest state of its data.

What are these asynchronous events, you might ask? Anything that happens over time in your application can be represented by what is known as a Combine Publisher — network requests, user input, notifications, KVO, and much more. And since Combine unifies all of these different mechanisms under a single interface, this opens the door to interesting and powerful ways of composing logic and work in a declarative and universal way.

Combine is also tightly integrated throughout Apple’s SDKs. For example, the UI framework SwiftUI uses Combine to ensure your app’s views stay up to date, which makes Combine a must-have for your skillset.

We also recommend

Table of Contents

Section I: Introduction to Combine


Hello, Combine!

A gentle introduction to what kind of problems Combine solves, a back story of the roots of reactive programming on Apple's platforms, and a crash course into the basic moving pieces of the framework.


Publishers & Subscribers

The essence of Combine is that publishers send values to subscribers. In this chapter you’ll learn all about what that means and how to work with publishers and subscribers, and manage the subscriptions that are created between the two of them. This will start you on your foundation for learning Operators, making an app that creates simple photo collages, testing and debugging.

Section II: Operators


Transforming Operators

Before a subscriber receives values from a publisher, you’ll often want to manipulate those values in some way. One of the most common things you’ll want to do is transform those values into some form that is ideal for use by the subscriber. By the end of this chapter you’ll be transforming all the things.


Filtering Operators

In this chapter you'll learn about filtering elements from Combine publishers, so you can easily control the values published by the upstream and only deal with the ones you care about.


Combining Operators

Publishers are extremely powerful, but they're even more powerful when composed together! This chapter will teach you about Combine's combining operators which let you take multiple streams and create meaningful logical relationships between them.


Time Manipulation Operators

A large part of asynchronous programming relating to processing values over time, this chapter goes into the details of performing complex time-based tasks that would be hard to do without Combine.


Sequence Operators

When you think about it, Publishers are merely sequences. As such, there are many useful operators that let you target specific elements, or gather information about the sequence as a whole, which you'll learn about in this chapter.


In Practice: Project "Collage"

It's time to try your new Combine skills in a real project and learn how to make Foundation and UIKit play along with your reactive code.

Section III: Combine in Action



This chapter teaches you how to seamlessly integrate network requests in Combine publisher chains and make your networking easier and more resilient.



Debugging asynchronous code being notoriously harder linear code, Combine helps with a few tools that will greatly help you improve your understanding of the processes at play.



A niche part of your code, timers are always useful to have around and easy to create in Combine, as you’ll learn in this chapter.


Key-Value Observing

This chapter shows you how Key-Value Observing, which was historically the best way to get notified when a value changed, now integrates nicely with Combine publishers.


Resource Management

Precisely controlling resource usage is a touchy subject, but this chapter will shed light on sharing operators which let you do just that.


In Practice: Project "News"

In this chapter you will work on a networking API that talks in real-time to the Hacker News servers and along the way exercise using multiple operators and publishers in Foundation.

Section IV: Advanced Combine


In Practice: SwiftUI & Combine

SwiftUI is the new user interface paradigm from Apple and it's designed for an interplay with Combine on a whole new level. In this chapter you are going to work through a Combine based SwiftUI project.


Error Handling in Practice

This chapter will teach about Combine's powerful typed error system, and how you can leverage it to handle errors in your app, and within Combine publishers.



In this chapter you’ll learn what Schedulers are, how they relate to RunLoops, Dispatch queues and Threads and how Combine extends Foundation to integrate with them.


Custom Publishers & Handling Backpressure

Creating your own publishers and operators is an advanced topic you’ll learn to master in this chapter, while also learning about and experimenting with backpressure management.



This chapter will introduce you to unit testing techniques for use with Combine code. You’ll go from testing basics in a playground to applying what you’ve learned in adding tests to an existing iOS app project.

Section V: Building a Complete App


In Practice: Building a Complete App

You’ve gained valuable skills throughout this book, and in the last section you picked up some advanced Combine know how too. In this final chapter, the pièce de résistance, you’ll build a complete app that applies what you’ve learned—but the learning is not done yet! Core Data in Combine anyone?

Meet the Team

Average Rating

4.2 /5

Leave a review for this product

34 reviews

Combine: Asynchronous Programming with Swift

The best book to master declarative asynchronous programming with Swift using the Combine framework!

The introduction of Combine into the Swift ecosystem now gives you a native way to manage asynchronous events in Swift, meaning you don’t have to rely on third-party reactive frameworks for event-driven systems.