Instance Method

tryFirst(where:)

Publishes the first element of a stream to satisfy a throwing predicate closure, then finishes.

Declaration

func tryFirst(where predicate: @escaping ((Output0, Output1)) throws -> Bool) -> Publishers.TryFirstWhere<Publishers.MapKeyPath2<Upstream, Output0, Output1>>

Parameters

predicate

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

Return Value

A publisher that only publishes the first element of a stream that satifies the predicate.