Skip to content
Commitwise
Menu

Publisher (Combine)

A Combine type that emits values over time, then finishes or fails, to subscribers that request them.

Definition

Publishers are chained with operators such as map, filter and debounce, and end in a subscriber such as sink or assign. A subscription lasts as long as its AnyCancellable. A failure ends the stream for good, so long-lived pipelines handle errors inside, per request.

In practice

$query.debounce(...).map { api.search($0) }.switchToLatest() turns typing into search results.

Learn it in context

Lessons that use this term.

Related terms

Esc

Type to search the whole site.