Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save harrysummers/2102f6b2aa2db1855ae52aedeef94b4d to your computer and use it in GitHub Desktop.
Save harrysummers/2102f6b2aa2db1855ae52aedeef94b4d to your computer and use it in GitHub Desktop.
CollectionView delegates
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let gif = gifs[indexPath.row]
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: cellId, for: indexPath) as! GifCollectionViewCell
cell.gifView.loadGif(name: gif)
return cell
}
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return 3
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment