Instance Method

removeDuplicates(by:)

Publishes only elements that don’t match the previous element, as evaluated by a provided closure.

Declaration

func removeDuplicates(by predicate: @escaping (DeferredPublisher.Output, DeferredPublisher.Output) -> Bool) -> Publishers.RemoveDuplicates<Deferred<DeferredPublisher>>

Parameters

predicate

A closure to evaluate whether two elements are equivalent, for purposes of filtering. Return true from this closure to indicate that the second element is a duplicate of the first.

Return Value

A publisher that consumes — rather than publishes — duplicate elements.