Instance Method

sink(receiveCompletion:receiveValue:)

Attaches a subscriber with closure-based behavior.

Declaration

func sink(receiveCompletion: @escaping ((Subscribers.Completion<A.Failure>) -> Void), receiveValue: @escaping (((A.Output, B.Output, C.Output, D.Output)) -> Void)) -> AnyCancellable

Parameters

receiveCompletion

The closure to execute on receipt of a value. If nil, the sink uses an empty closure.

receiveValue

The closure to execute on completion. If nil, the sink uses an empty closure.

Return Value

A subscriber that performs the provided closures upon receiving values or completion.

Discussion

This method creates the subscriber and immediately requests an unlimited number of values, prior to returning the subscriber.