Daniel Tull: Blog

Introducing Combine

Tuesday, 22 July 2025

The new Combine framework from Apple provides many different types of publisher, which I will largely group into two types: sources and modifiers.

Source publishers take a signal generated in a non-Combine way and provide a way to subscribe to it. Examples of this include Notification Publisher, KVOPublisher and DataTaskPublisher.

Modifier publishers take one or more publishers and change the signal, these include MapPublisher, …

We can use

Most publishers have a convenience method to create them, so we generally don’t initialise them directly. Given we have a DataTaskPublisher and a transform function called convert, we can

the convenience dataTaskPublisher.map(convert) will provide exactly the same result as MapPublisher(dataTaskPublisher, transform: convert), but it’s nicer to use and read.

This inversion also allows us to chain publishers

There are a few different parts to the Combine system, including Publisher, Subscriber and Subscription.

A publisher provides an Output, a type of value that it vends 1 or more times.

Publishers don’t start publishing until a subscriber starts subscriber to its events, creating a subscription for each subscriber.

6