I have a timer in a collection view in a timer, and it ticks down, but every time I swipe, in the middle of the swipe the timer just stops
As you see in the picture the timer is still when you swipe,it only starts ticking when you are done with the swipe. Here is the code:
timer = Timer.scheduledTimer(timeInterval: 1.0, target: self, selector: #selector(QuestionsViewController.update), userInfo: nil, repeats: true)
self.navigationItem.setHidesBackButton(true, animated: true)
func update() {
if counter >= 0 {
self.title = "Time Left: \(String(self.counter))"
counter -= 1
} else {
alert()
timer!.invalidate()
}
}
What am I doing wrong?