Last active
August 1, 2021 15:01
-
-
Save YudhistherAryan/e13ce125ff44bb17557bc5a0e9a5e0cf to your computer and use it in GitHub Desktop.
How to get the index of visible cell in the UICollectionView
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Put this function into the extension of the UICollectionVIewDelegate and you will get the index of the current cell displaying. | |
// This will be helpful when you will implemenet the image slider with the help of the collectionView(by default pagination of the collectionView). | |
func collectionView(_ collectionView: UICollectionView, didEndDisplaying cell: UICollectionViewCell, forItemAt indexPath: IndexPath) { | |
print("Currently visible cell is \(self.collectionView.indexPathsForVisibleItems)") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment