瀏覽代碼

Reapply should change checking

onevcat 2 年之前
父節點
當前提交
4177bac5e9
共有 1 個文件被更改,包括 7 次插入9 次删除
  1. 7 9
      Sources/Views/AnimatedImageView.swift

+ 7 - 9
Sources/Views/AnimatedImageView.swift

@@ -460,15 +460,13 @@ open class AnimatedImageView: KFCrossPlatformImageView {
             // Some devices (like iPad Pro 10.5) will have a different FPS.
             // Some devices (like iPad Pro 10.5) will have a different FPS.
             duration = 1.0 / TimeInterval(preferredFramesPerSecond)
             duration = 1.0 / TimeInterval(preferredFramesPerSecond)
         }
         }
-
-        animator.shouldChangeFrame(with: duration) { [weak self] hasNewFrame in
-            if hasNewFrame {
-                #if os(macOS)
-                self?.layer?.setNeedsDisplay()
-                #else
-                self?.layer.setNeedsDisplay()
-                #endif
-            }
+        
+        if animator.shouldChangeFrame(with: duration) {
+            #if os(macOS)
+            layer?.setNeedsDisplay()
+            #else
+            layer.setNeedsDisplay()
+            #endif
         }
         }
     }
     }
 }
 }