Generic Instance Method

timeout(_:scheduler:options:customError:)

Terminates publishing if the upstream publisher exceeds the specified time interval without producing an element.

Declaration

func timeout<S>(_ interval: S.SchedulerTimeType.Stride, scheduler: S, options: S.SchedulerOptions? = nil, customError: (() -> Upstream.Failure)? = nil) -> Publishers.Timeout<Publishers.Buffer<Upstream>, S> where S : Scheduler

Parameters

interval

The maximum time interval the publisher can go without emitting an element, expressed in the time system of the scheduler.

scheduler

The scheduler to deliver events on.

options

Scheduler options that customize the delivery of elements.

customError

A closure that executes if the publisher times out. The publisher sends the failure returned by this closure to the subscriber as the reason for termination.

Return Value

A publisher that terminates if the specified interval elapses with no events received from the upstream publisher.