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 (Elements.Element) -> T?) -> Publishers.CompactMap<Publishers.Sequence<Elements, Failure>, 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.