Generic Instance Method


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


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



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


The scheduler to deliver events on.


Scheduler options that customize the delivery of elements.


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.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software