Generic Instance Method

compactMap(_:)

Calls a closure with each received element and publishes any returned optional that has a value.

Declaration

func compactMap<T>(_ transform: @escaping (Prefix.Output) -> T?) -> Publishers.CompactMap<Publishers.Concatenate<Prefix, Suffix>, T>

Parameters

transform

A closure that receives a value and returns an optional value.

Return Value

A publisher that republishes all non-nil results of calling the transform closure.

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