11.10 · Cancelling and completing, the cycle that survives a deinit, and failure types

Two kinds of mistakes remain once the operators are right: pipelines that live longer (or shorter) than intended, and error types that do not line up.

Mental model. A subscription lives as long as something holds its cancellable, and a cancellable held by the object whose closure it runs is a cycle. Failure types must match exactly.

Ending and holding

Completing early, cancelling, and the cycle through a stored cancellable.

  1. How do you end a pipeline: prefix(untilOutputFrom:), cancel and completion, and why does a sink that captures self and is stored on self never deinit? 11.10.1 · L3
    A pipeline ends in one of three ways: the upstream completes or fails; a downstream operator completes early; or the subscriber cancels.…

Types

Matching failure types when you combine or convert publishers.

  1. Why does merging or combining publishers fail to compile with “types Never and E must be equivalent”, and how do setFailureType, mapError and tryMap fix it? 11.10.2 · L3
    Every publisher has an Output and a Failure, and operators that combine publishers (merge, combineLatest, zip, flatMap) require the failure types to be…

More in Combine