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...
I found to work reliably on all devices and correctly handle iPhone X-style safe areas.
let top = CGPoint(x: collectionView.contentOffset.x,
y: collectionView.adjustedContentInset.top)
collectionView.setContentOffset(top, animated: false)
(This scrolls vertically to the top but you could easily make it scroll to the top-left if you wanted.)