Я пытаюсь отобразить Gif-файлы в виде коллекции с URL-адресом, загруженным из Firebase. Я уже пытался использовать импорт Gifu. Любая идея о том, как загрузить Gif в представление коллекции?
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)")
}