     func nowIfNeeded() {
         if scheduled { now() }
     }
-
 }

    }

    @objc func now() {
        cancel()
        action()
        next = Date(timeIntervalSinceNow: maxDelay)
    }

    func later() {
        if scheduled { return }
        let now = Date()
        if next < now {
            self.now()

    var maxDelay: TimeInterval
    let action: () -> Void
    private var scheduled = false
    private var performing = false
    private var next = Date.distantPast

    init(maxDelay: TimeInterval, action: @escaping () -> Void) {
