Instance Method

handleEvents(receiveSubscription:receiveOutput:receiveCompletion:receiveCancel:receiveRequest:)

Performs the specified closures when publisher events occur.

Declaration

func handleEvents(receiveSubscription: ((Subscription) -> Void)? = nil, receiveOutput: ((Upstream.Output) -> Void)? = nil, receiveCompletion: ((Subscribers.Completion<Error>) -> Void)? = nil, receiveCancel: (() -> Void)? = nil, receiveRequest: ((Subscribers.Demand) -> Void)? = nil) -> Publishers.HandleEvents<Publishers.TryLastWhere<Upstream>>

Parameters

receiveSubscription

A closure that executes when the publisher receives the subscription from the upstream publisher. Defaults to nil.

receiveOutput

A closure that executes when the publisher receives a value from the upstream publisher. Defaults to nil.

receiveCompletion

A closure that executes when the publisher receives the completion from the upstream publisher. Defaults to nil.

receiveCancel

A closure that executes when the downstream receiver cancels publishing. Defaults to nil.

receiveRequest

A closure that executes when the publisher receives a request for more elements. Defaults to nil.

Return Value

A publisher that performs the specified closures when publisher events occur.