Instance Method

tryLast(where:)

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

Declaration

func tryLast(where predicate: @escaping (A.Output) throws -> Bool) -> Publishers.TryLastWhere<Publishers.Merge5<A, B, C, D, E>>

Parameters

predicate

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.

Discussion

If the predicate closure throws, the publisher fails with the thrown error.