Reputation: 640
I use Timer to update my progress bar every 0.025 second, but when i'm scrolling my collectionView or tableView or any scrollView, my timer doesn't run caused my progress bar is stucked for a moment until i ended my scroll action. I have used CADisplayLink as a timer, but still it has the same behavior. What is the best method to solve this issue ? I have seen circular progress play button in iTunes preview song still updating even when i'm scrolling the view, so i'm sure this issue is possible to solved.
Upvotes: 3
Views: 233
Reputation: 640
I have figured it out what i'm missing.
Just add this code after you scheduled your timer and it will still work when you are scrolling your tableView or collectionView
RunLoop.current.add(self.timer!, forMode: RunLoopMode.commonModes)
Upvotes: 2