Instance Method

allSatisfy(_:)

Publishes a single Boolean value that indicates whether all received elements pass a given predicate.

Declaration

func allSatisfy(_ predicate: @escaping (Upstream.Output) -> Bool) -> Publishers.AllSatisfy<Publishers.Share<Upstream>>

Parameters

predicate

A closure that evaluates each received element. Return true to continue, or false to cancel the upstream and complete.

Return Value

A publisher that publishes a Boolean value that indicates whether all received elements pass a given predicate.

Discussion

When this publisher receives an element, it runs the predicate against the element. If the predicate returns false, the publisher produces a false value and finishes. If the upstream publisher finishes normally, this publisher produces a true value and finishes. As a reduce-style operator, this publisher produces at most one value. Backpressure note: Upon receiving any request greater than zero, this publisher requests unlimited elements from the upstream publisher.

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