11.6 · Combine versus async/await, and testing pipelines

Combine is still in many codebases and still asked about, but it is no longer the default tool for new asynchronous code. The skill is knowing where it earns its place.

Mental model. Streams of many values over time with operators are Combine’s strength. One result, or an ordered sequence you consume is async/await’s.

Choosing and testing

When to use Combine, async sequences or observation, and how to test pipelines.

  1. When do you use Combine, AsyncSequence or the Observation framework, and when should you not use Combine? 11.6.1 · L5
    Combine is a push-based, operator-rich framework: it models a value changing over time and composes streams declaratively (combineLatest, debounce…
  2. How do you test Combine pipelines, and what is a TestScheduler pattern? 11.6.2 · L3
    A pipeline is easiest to test when its inputs and its scheduler are injected. The simplest tests are synchronous: feed a PassthroughSubject or an array…

More in Combine