I have an Horizontal
UICollectionView
on my app and I want to load more data when the user reaches the end (or nearly to the end) of UICollectionView w
This is simple login which will go down to last index...!!!
func ScrollEnd() {
let lastSectionIndex = (self.collectionView?.numberOfSections)! - 1
let lastItemIndex = (self.collectionView.numberOfItems(inSection: lastSectionIndex)) - 1
let index = IndexPath(item: lastItemIndex, section: lastSectionIndex)
if messages.count != 0{
self.collectionView!.scrollToItem(at: index, at: UICollectionView.ScrollPosition.bottom, animated: false)
} }