Generic Instance Method

drop(untilOutputFrom:)

Ignores elements from the upstream publisher until it receives an element from a second publisher.

Declaration

func drop<P>(untilOutputFrom publisher: P) -> Publishers.DropUntilOutput<Publishers.TryLastWhere<Upstream>, P> where P : Publisher, Self.Failure == P.Failure

Parameters

publisher

A publisher to monitor for its first emitted element.

Return Value

A publisher that drops elements from the upstream publisher until the other publisher produces a value.

Discussion

This publisher requests a single value from the upstream publisher, and it ignores (drops) all elements from that publisher until the upstream publisher produces a value. After the other publisher produces an element, this publisher cancels its subscription to the other publisher, and allows events from the upstream publisher to pass through. After this publisher receives a subscription from the upstream publisher, it passes through backpressure requests from downstream to the upstream publisher. If the upstream publisher acts on those requests before the other publisher produces an item, this publisher drops the elements it receives from the upstream publisher.