Sfoglia il codice sorgente

VideoModel: Use swap helper

Soomin Lee 5 anni fa
parent
commit
389079fc26
1 ha cambiato i file con 1 aggiunte e 5 eliminazioni
  1. 1 5
      SharedSources/MediaLibraryModel/VideoModel.swift

+ 1 - 5
SharedSources/MediaLibraryModel/VideoModel.swift

@@ -77,11 +77,7 @@ extension VideoModel: MediaLibraryObserver {
         guard success else {
             return
         }
-
-        for (index, file) in files.enumerated() where file == media {
-            files[index] = media
-            break
-        }
+        files = swapModels(with: [media])
         updateView?()
     }
 }