Skip to content

Instantly share code, notes, and snippets.

@alcidesjunior
Created December 19, 2019 02:52
Show Gist options
  • Save alcidesjunior/fd1731ca19e1f8000b61590e18a5b606 to your computer and use it in GitHub Desktop.
Save alcidesjunior/fd1731ca19e1f8000b61590e18a5b606 to your computer and use it in GitHub Desktop.
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "movieCell", for: indexPath) as! MovieCollectionViewCell
cell.movieTitle.text = self.movies[indexPath.item].originalTitle
guard let imageUrl = URL(string: "\(EndPoints.baseImageUrl.rawValue)\(self.movies[indexPath.item].posterPath)") else{return cell}
DispatchQueue.main.async {
cell.movieImageView.load(url: imageUrl)
}
return cell
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment