Explorar o código

use best practise for dequeueReusableCell() calls

B. Petersen %!s(int64=2) %!d(string=hai) anos
pai
achega
53b87c1a0f
Modificáronse 1 ficheiros con 1 adicións e 5 borrados
  1. 1 5
      deltachat-ios/Controller/GalleryViewController.swift

+ 1 - 5
deltachat-ios/Controller/GalleryViewController.swift

@@ -185,11 +185,7 @@ extension GalleryViewController: UICollectionViewDataSource, UICollectionViewDel
     }
 
     func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
-        guard let galleryCell = collectionView.dequeueReusableCell(
-                withReuseIdentifier: GalleryCell.reuseIdentifier,
-                for: indexPath) as? GalleryCell else {
-            return UICollectionViewCell()
-        }
+        let galleryCell = collectionView.dequeueReusableCell(withReuseIdentifier: GalleryCell.reuseIdentifier, for: indexPath) as? GalleryCell ?? GalleryCell()
 
         let msgId = mediaMessageIds[indexPath.row]
         var item: GalleryItem