             layout.sectionInset = UIEdgeInsets.zero
             layout.minimumInteritemSpacing = 1.0
             layout.minimumLineSpacing = 1.0
+
+            if #available(iOS 11.0, *) {
+                layout.sectionInsetReference = .fromSafeArea
+            }
         }
     }
     

        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

    }

    override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
        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
