Generic Instance Method


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


func tryMap<T>(_ transform: @escaping (Upstream.Output) throws -> T) -> Publishers.TryMap<Publishers.Share<Upstream>, T>



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.


If the transform closure throws an error, the publisher fails with the thrown error.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software