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 (Upstream.Output, Upstream.Output) -> Bool) -> Publishers.RemoveDuplicates<Publishers.TryLastWhere<Upstream>>

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.