SHARE
TWEET

Untitled

a guest Oct 12th, 2017 47 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
  2.  
  3.           let cellIndentifier = "cell"
  4.  
  5.           let cell = collectionView.dequeueReusableCell(withReuseIdentifier: cellIndentifier, for: indexPath) as! ImageCollectionViewCell
  6.  
  7.           // Supposed fix for scrolling performance issues
  8.           // on iOS collectionView
  9.           cell.layer.shouldRasterize = true
  10.           cell.layer.rasterizationScale = UIScreen.main.scale
  11.  
  12.           let image = self.images[indexPath.row]
  13.  
  14.           // Load the image
  15.           let url = URL(string: image.urls.small)
  16.           let data = try? Data(contentsOf: url!)
  17.           cell.imageView.image = UIImage(data: data!)
  18.          
  19.           return cell
  20.      }
RAW Paste Data
Top