     }
 
     override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
-        let cell = collectionView.dequeueReusableCell(withReuseIdentifier: FlickrCameraRollCollectionViewCell.reuseIdentifier,
-                                                      for: indexPath) as! FlickrCameraRollCollectionViewCell
-        configure(cell: cell, at: indexPath)
-
-        return cell
+        return collectionView.dequeueReusableCell(
+            withReuseIdentifier: FlickrCameraRollCollectionViewCell.reuseIdentifier,
+            for: indexPath
+        )
+    }
+
+    override func collectionView(_ collectionView: UICollectionView,
+                                 willDisplay cell: UICollectionViewCell,
+                                 forItemAt indexPath: IndexPath) {
+        configure(cell: cell as! FlickrCameraRollCollectionViewCell, at: indexPath)
     }
 
     // MARK: Private Helpers

        guard let layout = collectionViewLayout as? UICollectionViewFlowLayout else {
            return CGSize.zero
        }
        
        let sectionInsets = layout.sectionInset
        let minimumInteritemSpacing = layout.minimumInteritemSpacing
        
        let remainingWidth = collectionView.bounds.width
            - sectionInsets.left
            - CGFloat((numberOfColumns - 1)) * minimumInteritemSpacing
            - sectionInsets.right

            layout.sectionInset = UIEdgeInsets.zero
            layout.minimumInteritemSpacing = 1.0
            layout.minimumLineSpacing = 1.0

            if #available(iOS 11.0, *) {
                layout.sectionInsetReference = .fromSafeArea
            }
        }
    }
    
