I'm creating an UICollectionView that moves automatically, without user interaction, using:
private func startWaterfallAnimation() {
var timer = Timer.init()
timer = Timer.scheduledTimer(withTimeInterval: 0.06, repeats: true) { (_) in
if !self.isPaused{
UIView.animate(withDuration: 0.06, delay: 0, options: [.curveLinear], animations: {
self.setContentOffset(CGPoint(x: self.contentOffset.x, y: self.contentOffset.y - CGFloat(self.speed)), animated: false)
}, completion: nil)
} else {
timer.invalidate()
}
}
}
Unfortunately, this is the behaviour: https://giphy.com/gifs/1xV9RiPlOoSTugIx1s, cells flick when moving.
My question is: How can I programmatically scroll in a smooth way at Apple TV, without the flick? Maybe another approach?