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

# init(upstream:predicate:)

Creates a publisher that republishes elements while an error-throwing predicate closure indicates publishing should continue.

## Declaration

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

## Parameters

- `upstream`: The publisher from which this publisher receives elements.
- `predicate`: The error-throwing closure that determines whether publishing should continue.
