I have some code in my UIView based on a timer like this:
//Start timer
self.timer = Timer.scheduledTimer(withTimeInterval: 1.0, repeats: true, block: {
timer in
if self.timerCount > 0 {
let minutes = Int(self.timerCount/60)
let seconds = Int(self.timerCount%60)
UIView.performWithoutAnimation {
self.proxyView!.confirmButton.setTitle(CHRText.apptConfirmButton + " (" + String(describing:minutes) + ":" + String(describing: seconds) + ")", for: UIControlState.normal)
}
self.timerCount -= 1
}
else{
self.timer!.invalidate()
}
})
The code works fine, except for one issue. When I am scrolling a UIScrollView also in the view, the button title will not update. After I complete my scrolling, all updates to the title occur in rapid succession as if queued. How can I have this text continually update without freezing while scrolling?