Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
- let cellIndentifier = "cell"
- let cell = collectionView.dequeueReusableCell(withReuseIdentifier: cellIndentifier, for: indexPath) as! ImageCollectionViewCell
- // Supposed fix for scrolling performance issues
- // on iOS collectionView
- cell.layer.shouldRasterize = true
- cell.layer.rasterizationScale = UIScreen.main.scale
- let image = self.images[indexPath.row]
- // Load the image
- let url = URL(string: image.urls.small)
- let data = try? Data(contentsOf: url!)
- cell.imageView.image = UIImage(data: data!)
- return cell
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement