Explorar el Código

VideoModel: Use swap helper

Soomin Lee hace 5 años
padre
commit
389079fc26
Se han modificado 1 ficheros con 1 adiciones y 5 borrados
  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?()
     }
 }