init(upstream:initialResult:nextPartialResult:)
Creates a publisher that transforms elements from the upstream publisher by providing the current element to a failable closure along with the last value returned by the closure.
Declaration
init(upstream: Upstream, initialResult: Output, nextPartialResult: @escaping (Output, Upstream.Output) throws -> Output)Parameters
- upstream:
The publisher that this publisher receives elements from.
- initialResult:
The previous result returned by the
nextPartialResultclosure. - nextPartialResult:
An error-throwing closure that takes as its arguments the previous value returned by the closure and the next element emitted from the upstream publisher.