Browse Source

Replace published to set observer

onevcat 4 years ago
parent
commit
133385384f
1 changed files with 10 additions and 2 deletions
  1. 10 2
      Sources/SwiftUI/ImageBinder.swift

+ 10 - 2
Sources/SwiftUI/ImageBinder.swift

@@ -50,8 +50,16 @@ extension KFImage {
 
         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.")
         init(source: Source?, options: KingfisherOptionsInfo? = nil, isLoaded: Binding<Bool>) {