Snap to center of a cell when scrolling UICollectionView horizontally
While originally I was using Objective-C, I since switched so Swift and the original accepted answer did not suffice. I ended up creating a UICollectionViewLayout subclass which provides the best (imo) experience as opposed to the other functions which alter content offset or something similar when the user has stopped scrolling. class SnappingCollectionViewLayout: UICollectionViewFlowLayout { … Read more