Terminates publishing if the upstream publisher exceeds the specified time interval without producing an element.
SDKs
- iOS 13.0+
- macOS 10.15+
- Mac Catalyst 13.0+
- tvOS 13.0+
- watchOS 6.0+
- Xcode 11.0+
Framework
- Combine
Declaration
func timeout<S>(_ interval: S.SchedulerTimeType.Stride, scheduler: S, options: S.SchedulerOptions? = nil, customError: (() -> Error)? = nil) -> Publishers.Timeout<Publishers.Try Comparison<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.