I'm trying to display Gifs in a collection view with URL downloaded from Firebase. I already tried using Gifu import. Any idea on how to load the Gif into the collection view?
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return self.posts.count
}
func numberOfSections(in collectionView: UICollectionView) -> Int {
return 1
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier:"gifCell", for: indexPath) as! GifPostCell
//cell.gifPostImage.downloadImage(from: self.posts[indexPath.row].pathToGif)
cell.gifPostImage.animate(withGIFURL: self.posts[indexPath.row].pathToGif)
return cell
}
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
print("User photo selected: \(indexPath.row)")
}