← All daysDay 35 of 49 · Part 9: Swift concurrency
Day 35

Combine: reading legacy code

These are the lesson notes for this day. Its build-along tutorial and flash cards have not been written yet.

Lesson 40

Combine: reading legacy code

Combine is Apple's reactive framework from 2019. It has not been deprecated, but it has not changed in any meaningful way since 2020. SwiftUI stopped depending on it in 2023, when @Observable arrived. And in February 2026 the instructions Xcode 26.3 gives its built-in coding agents said to avoid Combine and use async/await instead. Treat it as legacy: you need to be able to read it and migrate it, not to write new code with it.

If you know RxSwift you already know Combine. A Publisher is an Observable. An AnyCancellable is a Disposable. sink is subscribe. The operators have the same names. The bridges to modern code are these: publisher.values turns any publisher into an AsyncSequence; .onReceive consumes a publisher inside a view; and an ObservableObject with @Published properties becomes an @Observable class. Combine is still the simplest tool when several subscribers need to receive the same stream of values.

Exercise

Take a view model that uses @Published and a Combine pipeline — a debounced search, for example. Convert it to @Observable and async/await, and keep its tests passing throughout.

After this lesson you should be able to answer
  1. What is Combine's status in 2026?
  2. How do you consume a Combine publisher from async/await code?
  3. In what situation is Combine still the better tool?
Resources