---
title: max()
framework: combine
role: symbol
role_heading: Instance Method
path: combine/publisher/max()
---

# max()

Publishes the maximum value received from the upstream publisher, after it finishes.

## Declaration

```swift
func max() -> Publishers.Comparison<Self>
```

## Return Value

Return Value A publisher that publishes the maximum value received from the upstream publisher, after the upstream publisher finishes.

## Discussion

Discussion Use max() to determine the maximum value in the stream of elements from an upstream publisher. In the example below, the max() operator emits a value when the publisher finishes, that value is the maximum of the values received from upstream, which is 10. let numbers = [0, 10, 5] cancellable = numbers.publisher     .max()     .sink { print("\($0)") }

// Prints: "10" After this publisher receives a request for more than 0 items, it requests unlimited items from its upstream publisher.

## See Also

### Applying mathematical operations on elements

- [count()](combine/publisher/count().md)
- [max(by:)](combine/publisher/max(by:).md)
- [tryMax(by:)](combine/publisher/trymax(by:).md)
- [min()](combine/publisher/min().md)
- [min(by:)](combine/publisher/min(by:).md)
- [tryMin(by:)](combine/publisher/trymin(by:).md)
