Add hideTimer to RunLoop's common modes.
arror opened this issue · 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)
}
Piergiuseppe Longo commented
Can you add an explanation?
xuxiang commented
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