Auto snapping when scroll decelerating in UITableView or UICollectionView
Using AutoSnapping / Not at
// In your tableView delegate class
func scrollViewWillEndDragging(scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer<CGPoint>) {
self.tableView.autoSnapping(velocity: velocity, targetOffset: targetContentOffset)
}
// In your collectionView delegate class
func scrollViewWillEndDragging(scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer<CGPoint>) {
self.collectionView.autoSnapping(velocity: velocity, targetOffset: targetContentOffset)
}
MIT