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

# init(upstream:transform:)

Creates a publisher that transforms all elements from the upstream publisher with a provided error-throwing closure.

## Declaration

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

## Parameters

- `upstream`: The publisher from which this publisher receives elements.
- `transform`: The error-throwing closure that transforms elements from the upstream publisher.
