Просмотр исходного кода

Replace published to set observer

onevcat 4 лет назад
Родитель
Сommit
133385384f
1 измененных файлов с 10 добавлено и 2 удалено
  1. 10 2
      Sources/SwiftUI/ImageBinder.swift

+ 10 - 2
Sources/SwiftUI/ImageBinder.swift

@@ -50,8 +50,16 @@ extension KFImage {
 
 
         var isLoaded: Binding<Bool>
         var isLoaded: Binding<Bool>
 
 
-        @Published var loaded = false
-        @Published var loadedImage: KFCrossPlatformImage? = nil
+        var loaded = false {
+            willSet {
+                objectWillChange.send()
+            }
+        }
+        var loadedImage: KFCrossPlatformImage? = nil {
+            willSet {
+                objectWillChange.send()
+            }
+        }
 
 
         @available(*, deprecated, message: "The `options` version is deprecated And will be removed soon.")
         @available(*, deprecated, message: "The `options` version is deprecated And will be removed soon.")
         init(source: Source?, options: KingfisherOptionsInfo? = nil, isLoaded: Binding<Bool>) {
         init(source: Source?, options: KingfisherOptionsInfo? = nil, isLoaded: Binding<Bool>) {