Skip to content

Instantly share code, notes, and snippets.

import Dispatch
private var throttleItems = Atomic([AnyHashable: ThrottleItem]())
private var debounceItems = Atomic([AnyHashable: DebounceItem]())
extension DispatchQueue {
/// First action is executed, then other actions will be performed at most once per specified interval.
/// - Note:
/// Only the first call's `interval` is taken into account and updated every interval.