onevcat 4 лет назад
Родитель
Сommit
3f5b549db8
2 измененных файлов с 4 добавлено и 9 удалено
  1. 0 3
      Sources/SwiftUI/ImageBinder.swift
  2. 4 6
      Sources/SwiftUI/KFImageRenderer.swift

+ 0 - 3
Sources/SwiftUI/ImageBinder.swift

@@ -49,9 +49,6 @@ extension KFImage {
         @Published var progress: Progress = .init()
         @Published var progress: Progress = .init()
 
 
         func start<HoldingView: KFImageHoldingView>(context: Context<HoldingView>) {
         func start<HoldingView: KFImageHoldingView>(context: Context<HoldingView>) {
-
-            guard !loadingOrSucceeded else { return }
-
             guard let source = context.source else {
             guard let source = context.source else {
                 CallbackQueue.mainCurrentOrAsync.execute {
                 CallbackQueue.mainCurrentOrAsync.execute {
                     context.onFailureDelegate.call(KingfisherError.imageSettingError(reason: .emptySource))
                     context.onFailureDelegate.call(KingfisherError.imageSettingError(reason: .emptySource))

+ 4 - 6
Sources/SwiftUI/KFImageRenderer.swift

@@ -37,11 +37,7 @@ struct KFImageRenderer<HoldingView> : View where HoldingView: KFImageHoldingView
     let context: KFImage.Context<HoldingView>
     let context: KFImage.Context<HoldingView>
     
     
     var body: some View {
     var body: some View {
-        if !context.options.forceTransition {
-            binder.start(context: context)
-        }
-        
-        return ZStack {
+        ZStack {
             context.configurations
             context.configurations
                 .reduce(HoldingView.created(from: binder.loadedImage, context: context)) {
                 .reduce(HoldingView.created(from: binder.loadedImage, context: context)) {
                     current, config in config(current)
                     current, config in config(current)
@@ -59,7 +55,9 @@ struct KFImageRenderer<HoldingView> : View where HoldingView: KFImageHoldingView
                     guard let binder = binder else {
                     guard let binder = binder else {
                         return
                         return
                     }
                     }
-                    binder.start(context: context)
+                    if !binder.loadingOrSucceeded {
+                        binder.start(context: context)
+                    }
                 }
                 }
                 .onDisappear { [weak binder = self.binder] in
                 .onDisappear { [weak binder = self.binder] in
                     guard let binder = binder else {
                     guard let binder = binder else {