<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Combine",
  "identifier" : "/documentation/Combine/Publishers/TryRemoveDuplicates",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Combine"
    ],
    "preciseIdentifier" : "s:7Combine10PublishersO19TryRemoveDuplicatesV"
  },
  "title" : "Publishers.TryRemoveDuplicates"
}
-->

# Publishers.TryRemoveDuplicates

A publisher that publishes only elements that don’t match the previous element, as evaluated by a provided error-throwing closure.

```
struct TryRemoveDuplicates<Upstream> where Upstream : Publisher
```

## Topics

### Creating a try-remove-duplicates publisher

[`init(upstream:predicate:)`](/documentation/Combine/Publishers/TryRemoveDuplicates/init(upstream:predicate:))

Creates a publisher that publishes only elements that don’t match the previous element, as evaluated by a provided error-throwing closure.

### Declaring supporting types

[`Publishers.Output`](/documentation/Combine/Publishers/Output)

A publisher that publishes elements specified by a range in the sequence of published elements.

### Inspecting publisher properties

[`upstream`](/documentation/Combine/Publishers/TryRemoveDuplicates/upstream)

The publisher from which this publisher receives elements.

[`predicate`](/documentation/Combine/Publishers/TryRemoveDuplicates/predicate)

An error-throwing closure to evaluate whether two elements are equivalent, for purposes of filtering.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)