I am having an issue using UIView.animate(withDuration) on a collectionView.
Here is the code I am using:
UIView.animate(withDuration: duration, delay: 0, options: [.curveEaseOut, .allowUserInteraction], animations: {
self.collectionView.setContentOffset(
CGPoint(
x: self.offsetForItem(0),
y: self.collectionView.contentOffset.y),
animated: false)
}, completion: { finished in
print("animation done")
})
My problem is the following: If I use animated: true the animation is almost instant and if I use animated false some of the elements from my collectionView disappear.
I have search SO for a solution on this issue but while there are many asking this question no provided solution has worked for me.
Thank you!