11.2 · map, scan, combineLatest, flatMap, switchToLatest, debounce, share

Operators are the vocabulary. A handful cover nearly everything: transform, combine, flatten, time, and share.

Mental model. Read a pipeline top to bottom as a conveyor belt: each operator takes what arrives and decides what to pass on, and when.

Transform and combine

Reading pipelines, merging and zipping.

  1. How do you read a pipeline, and how do combineLatest, merge, zip and scan differ? 11.2.1 · L2
    Read a pipeline from the source downward; each operator is a function from one publisher to another. Transform operators change values one at a time: map…

Flattening, timing and sharing

<code>flatMap</code>, <code>switchToLatest</code>, <code>debounce</code>, <code>share</code>.

  1. How do flatMap and switchToLatest differ, and when do you use each? 11.2.2 · L3
    flatMap turns each upstream value into another publisher and merges all of those inner publishers’ outputs into one stream. It keeps every inner publisher…
  2. What do debounce, throttle and removeDuplicates do, and what do share and multicast change? 11.2.3 · L3
    Timing operators reshape when values pass. debounce(for:scheduler:) waits until the stream has been quiet for the interval and then emits only the last value…

More in Combine