I\'m making use of UICollectionView and I need to scroll to first cell after click in a button.
The button is located in a (big) header section in my collection view...
The following solution works fine for me:
UIView.animate(withDuration: 0.5, animations: { self.collectionView?.contentOffset.x = 0 })
It scrolls to the first item and the contentInset can be seen as well.