---
title: "init(upstream:predicate:)"
framework: combine
role: symbol
role_heading: Initializer
path: "combine/publishers/lastwhere/init(upstream:predicate:)"
---

# init(upstream:predicate:)

Creates a publisher that waits until after the stream finishes and then publishes the last element of the stream that satisfies a predicate closure.

## Declaration

```swift
init(upstream: Upstream, predicate: @escaping (Publishers.LastWhere<Upstream>.Output) -> Bool)
```

## Parameters

- `upstream`: The publisher from which this publisher receives elements.
- `predicate`: The closure that determines whether to publish an element.
