<!--
{
  "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/Publisher/combineLatest(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Combine"
    ],
    "preciseIdentifier" : "s:7Combine9PublisherPAAE13combineLatestyAA10PublishersO0aD0Vy_xqd__Gqd__AaBRd__7FailureQyd__AJRtzlF"
  },
  "title" : "combineLatest(_:)"
}
-->

# combineLatest(_:)

Subscribes to an additional publisher and publishes a tuple upon receiving output from either publisher.

```
func combineLatest<P>(_ other: P) -> Publishers.CombineLatest<Self, P> where P : Publisher, Self.Failure == P.Failure
```

## Parameters

`other`

Another publisher to combine with this one.

## Return Value

A publisher that receives and combines elements from this and another publisher.

## Discussion

Use [`combineLatest(_:)`](/documentation/Combine/Publisher/combineLatest(_:)) when you want the downstream subscriber to receive a tuple of the most-recent element from multiple publishers when any of them emit a value. To pair elements from multiple publishers, use [`zip(_:)`](/documentation/Combine/Publisher/zip(_:)) instead. To receive just the most-recent element from multiple publishers rather than tuples, use [`merge(with:)`](/documentation/Combine/Publisher/merge(with:)-7qt71).

> Tip: The combined publisher doesn’t produce elements until each of its upstream publishers publishes at least one element.

The combined publisher passes through any requests to *all* upstream publishers. However, it still obeys the demand-fulfilling rule of only sending the request amount downstream. If the demand isn’t [`unlimited`](/documentation/Combine/Subscribers/Demand/unlimited), it drops values from upstream publishers. It implements this by using a buffer size of 1 for each upstream, and holds the most-recent value in each buffer.

In this example, [`PassthroughSubject`](/documentation/Combine/PassthroughSubject) `pub1` and also `pub2` emit values; as [`combineLatest(_:)`](/documentation/Combine/Publisher/combineLatest(_:)) receives input from either upstream publisher, it combines the latest value from each publisher into a tuple and publishes it.

```
let pub1 = PassthroughSubject<Int, Never>()
let pub2 = PassthroughSubject<Int, Never>()

cancellable = pub1
    .combineLatest(pub2)
    .sink { print("Result: \($0).") }

pub1.send(1)
pub1.send(2)
pub2.send(2)
pub1.send(3)
pub1.send(45)
pub2.send(22)

// Prints:
//    Result: (2, 2).    // pub1 latest = 2, pub2 latest = 2
//    Result: (3, 2).    // pub1 latest = 3, pub2 latest = 2
//    Result: (45, 2).   // pub1 latest = 45, pub2 latest = 2
//    Result: (45, 22).  // pub1 latest = 45, pub2 latest = 22
```

When all upstream publishers finish, this publisher finishes. If an upstream publisher never publishes a value, this publisher never finishes.

---

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)