---
title: "init(upstream:areInIncreasingOrder:)"
framework: combine
role: symbol
role_heading: Initializer
path: "combine/publishers/trycomparison/init(upstream:areinincreasingorder:)"
---

# init(upstream:areInIncreasingOrder:)

Creates a publisher that republishes items from another publisher only if each new item is in increasing order from the previously-published item, and fails if the ordering logic throws an error.

## Declaration

```swift
init(upstream: Upstream, areInIncreasingOrder: @escaping (Upstream.Output, Upstream.Output) throws -> Bool)
```

## Parameters

- `upstream`: The publisher from which this publisher receives its elements.
- `areInIncreasingOrder`: A closure that receives two elements and returns true if they are in increasing order.
