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

# Publishers.Merge

A publisher created by applying the merge function to two upstream publishers.

```
struct Merge<A, B> where A : Publisher, B : Publisher, A.Failure == B.Failure, A.Output == B.Output
```

## Topics

### Creating a merge publisher

[`init(A, B)`](/documentation/Combine/Publishers/Merge/init(_:_:))

Creates a publisher created by applying the merge function to two upstream publishers.

### Merging elements

[`func merge<P>(with: P) -> Publishers.Merge3<A, B, P>`](/documentation/Combine/Publishers/Merge/merge(with:))

[`func merge<Z, Y>(with: Z, Y) -> Publishers.Merge4<A, B, Z, Y>`](/documentation/Combine/Publishers/Merge/merge(with:_:))

[`func merge<Z, Y, X>(with: Z, Y, X) -> Publishers.Merge5<A, B, Z, Y, X>`](/documentation/Combine/Publishers/Merge/merge(with:_:_:))

[`func merge<Z, Y, X, W>(with: Z, Y, X, W) -> Publishers.Merge6<A, B, Z, Y, X, W>`](/documentation/Combine/Publishers/Merge/merge(with:_:_:_:))

[`func merge<Z, Y, X, W, V>(with: Z, Y, X, W, V) -> Publishers.Merge7<A, B, Z, Y, X, W, V>`](/documentation/Combine/Publishers/Merge/merge(with:_:_:_:_:))

[`func merge<Z, Y, X, W, V, U>(with: Z, Y, X, W, V, U) -> Publishers.Merge8<A, B, Z, Y, X, W, V, U>`](/documentation/Combine/Publishers/Merge/merge(with:_:_:_:_:_:))

### Declaring supporting types

[`typealias Output`](/documentation/Combine/Publishers/Merge/Output)

The kind of values published by this publisher.

[`typealias Failure`](/documentation/Combine/Publishers/Merge/Failure)

The kind of errors this publisher might publish.

### Inspecting publisher properties

[`let a: A`](/documentation/Combine/Publishers/Merge/a)

A publisher to merge.

[`let b: B`](/documentation/Combine/Publishers/Merge/b)

A second publisher to merge.

### Comparing publishers

[`static func == (Publishers.Merge<A, B>, Publishers.Merge<A, B>) -> Bool`](/documentation/Combine/Publishers/Merge/==(_:_:))

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

### Default Implementations

[Equatable Implementations](/documentation/Combine/Publishers/Merge/Equatable-Implementations)

## Relationships

### Conforms To

[`Publisher`](/documentation/Combine/Publisher)

[`Equatable`](/documentation/Swift/Equatable)

---

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)