Publishes elements only after a specified time interval elapses between events.
SDKs
- iOS 13.0+
- macOS 10.15+
- Mac Catalyst 13.0+
- tvOS 13.0+
- watchOS 6.0+
- Xcode 11.0+
Framework
- Combine
Declaration
func debounce<S>(for dueTime: S.SchedulerTimeType.Stride, scheduler: S, options: S.SchedulerOptions? = nil) -> Publishers.Debounce<Publishers.Share<Upstream>, S> where S : Scheduler
Parameters
dueTime
The time the publisher should wait before publishing an element.
scheduler
The scheduler on which this publisher delivers elements
options
Scheduler options that customize this publisher’s delivery of elements.
Return Value
A publisher that publishes events only after a specified time elapses.
Discussion
Use this operator when you want to wait for a pause in the delivery of events from the upstream publisher. For example, call debounce
on the publisher from a text field to only receive elements when the user pauses or stops typing. When they start typing again, the debounce
holds event delivery until the next pause.