pkluz/PKHUD

Add hideTimer to RunLoop's common modes.

arror opened this issue · 2 comments

arror commented
open func hide(afterDelay delay: TimeInterval, completion: TimerAction? = nil) {
        let key = UUID().uuidString
        let userInfo = ["timerActionKey": key]
        if let completion = completion {
            timerActions[key] = completion
        }

        hideTimer?.invalidate()
        hideTimer = Timer.scheduledTimer(timeInterval: delay,
                                                           target: self,
                                                           selector: #selector(PKHUD.performDelayedHide(_:)),
                                                           userInfo: userInfo,
                                                           repeats: false)
    }

Can you add an explanation?

Can you add an explanation?

hideTimer is in Default Mode of runloop, it should be added to Common Mode, otherwise, when scrollView slide, timer will stop