<!--
{
  "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/Contains",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Combine"
    ],
    "preciseIdentifier" : "s:7Combine10PublishersO8ContainsV"
  },
  "title" : "Publishers.Contains"
}
-->

# Publishers.Contains

A publisher that emits a Boolean value when it receives a specific element from its upstream publisher.

```
struct Contains<Upstream> where Upstream : Publisher, Upstream.Output : Equatable
```

## Topics

### Creating a contains Publisher

[`init(upstream:output:)`](/documentation/Combine/Publishers/Contains/init(upstream:output:))

Creates a publisher that emits a Boolean value when it receives a specific element from its upstream publisher.

### Declaring supporting types

[`Publishers.Contains.Output`](/documentation/Combine/Publishers/Contains/Output-swift.typealias)

The kind of values published by this publisher.

[`Publishers.Contains.Failure`](/documentation/Combine/Publishers/Contains/Failure)

The kind of errors this publisher might publish.

### Inspecting publisher properties

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

The publisher from which this publisher receives elements.

[`output`](/documentation/Combine/Publishers/Contains/output-swift.property)

The element to match in the upstream publisher.

### Comparing publishers

[`==(_:_:)`](/documentation/Combine/Publishers/Contains/==(_:_:))

Returns a Boolean value that indicates whether two publishers are equivalent.



---

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)