Skip to content

Commit f79cd4d

Browse files
committed
Remove the hack to macOS on AnimatedImage
1 parent 911f871 commit f79cd4d

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

SDWebImageSwiftUI/Classes/AnimatedImage.swift

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -221,11 +221,6 @@ public struct AnimatedImage : PlatformViewRepresentable {
221221
}
222222

223223
func updateView(_ view: AnimatedImageViewWrapper, context: Context) {
224-
// macOS SDAnimatedImageView.animates should initialize to true in advance before set image
225-
#if os(macOS)
226-
view.wrapped.animates = true
227-
#endif
228-
229224
if let image = self.image {
230225
#if os(watchOS)
231226
view.wrapped.setImage(image)
@@ -243,7 +238,9 @@ public struct AnimatedImage : PlatformViewRepresentable {
243238
}
244239

245240
#if os(macOS)
246-
view.wrapped.animates = self.isAnimating
241+
if self.isAnimating != view.wrapped.animates {
242+
view.wrapped.animates = self.isAnimating
243+
}
247244
#else
248245
if self.isAnimating != view.wrapped.isAnimating {
249246
if self.isAnimating {

0 commit comments

Comments
 (0)