AutoSnapping
Auto snapping when scroll decelerating in UITableView or UICollectionView
Demo
Using AutoSnapping / Not at
Sample
// 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)
}
LICENSE
MIT