Generic Instance Method

tryMap(_:)

Transforms all elements from the upstream publisher with a provided error-throwing closure.

Declaration

func tryMap<T>(_ transform: @escaping (Output) throws -> T) -> Publishers.TryMap<Publishers.Map<Upstream, Output>, 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.