Transforms all elements from the upstream publisher with a provided error-throwing closure.
SDKs
- iOS 13.0+
- macOS 10.15+
- Mac Catalyst 13.0+
- tvOS 13.0+
- watchOS 6.0+
- Xcode 11.0+
Framework
- Combine
Declaration
func tryMap<T>(_ transform: @escaping (Upstream.Output) throws -> T) -> Publishers.Try Map<Publishers.Share<Upstream>, T>
Parameters
transform
A closure that takes one element as its parameter and returns a new element.
Return Value
A publisher that uses the provided closure to map elements from the upstream publisher to new elements that it then publishes.
Discussion
If the transform
closure throws an error, the publisher fails with the thrown error.