Skip to content

Commit 847673d

Browse files
committed
Name the clearBufferWhenStopped to purgeable
1 parent f79cd4d commit 847673d

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

SDWebImageSwiftUI/Classes/AnimatedImage.swift

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public struct AnimatedImage : PlatformViewRepresentable {
6060
var customLoopCount: Int?
6161
var runLoopMode: RunLoop.Mode?
6262
var pausable: Bool?
63-
var clearBufferWhenStopped: Bool?
63+
var purgeable: Bool?
6464
var playBackRate: Double?
6565
#if os(macOS) || os(iOS) || os(tvOS)
6666
// These configurations only useful for web image loading
@@ -481,8 +481,8 @@ public struct AnimatedImage : PlatformViewRepresentable {
481481
}
482482

483483
// Clear Buffer
484-
if let clearBufferWhenStopped = self.clearBufferWhenStopped {
485-
view.wrapped.clearBufferWhenStopped = clearBufferWhenStopped
484+
if let purgeable = self.purgeable {
485+
view.wrapped.clearBufferWhenStopped = purgeable
486486
} else {
487487
view.wrapped.clearBufferWhenStopped = false
488488
}
@@ -656,8 +656,7 @@ extension AnimatedImage {
656656
return result
657657
}
658658

659-
/// Whether or not to pause the animation (keep current frame), instead of stop the animation (frame index reset to 0). When the `isAnimating` binding value changed to false.
660-
/// Defaults is true.
659+
/// Whether or not to pause the animation (keep current frame), instead of stop the animation (frame index reset to 0). When `isAnimating` binding value changed to false. Defaults is true.
661660
/// - Note: For some of use case, you may want to reset the frame index to 0 when stop, but some other want to keep the current frame index.
662661
/// - Parameter pausable: Whether or not to pause the animation instead of stop the animation.
663662
public func pausable(_ pausable: Bool) -> AnimatedImage {
@@ -666,12 +665,12 @@ extension AnimatedImage {
666665
return result
667666
}
668667

669-
/// Whether or not to clear frame buffer cache when stopped.
668+
/// Whether or not to clear frame buffer cache when stopped. Defaults is false.
670669
/// Note: This is useful when you want to limit the memory usage during frequently visibility changes (such as image view inside a list view, then push and pop)
671-
/// - Parameter clearBufferWhenStopped: Whether or not to clear frame buffer cache when stopped.
672-
public func clearBufferWhenStopped(_ clearBufferWhenStopped: Bool) -> AnimatedImage {
670+
/// - Parameter purgeable: Whether or not to clear frame buffer cache when stopped.
671+
public func purgeable(_ purgeable: Bool) -> AnimatedImage {
673672
var result = self
674-
result.clearBufferWhenStopped = clearBufferWhenStopped
673+
result.purgeable = purgeable
675674
return result
676675
}
677676

0 commit comments

Comments
 (0)