Instance Method


Only publishes the last element of a stream that satisfies a predicate closure, after the stream finishes.


func last(where predicate: @escaping (Upstream.Output) -> Bool) -> Publishers.LastWhere<Publishers.Share<Upstream>>



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

Return Value

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

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software