Instance Method

last(where:)

Publishes only the last element of a stream that satisfies a predicate closure, after the stream finishes.

Declaration

func last(where predicate: @escaping ((Output0, Output1)) -> Bool) -> Publishers.LastWhere<Publishers.MapKeyPath2<Upstream, Output0, Output1>>

Parameters

predicate

A closure that takes an element as its parameter and returns a Boolean value that indicates whether to publish the element.

Return Value

A publisher that only publishes the last element satisfying the given predicate.