Skip to content

Commit 5b5910e

Browse files
committed
Add stopAnimating to ShimmerReplicatorView
1 parent a282e10 commit 5b5910e

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

ShimmerView/ShimmerReplicatorView.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,4 +174,11 @@ public class ShimmerReplicatorView: UIView {
174174
$0.startAnimating()
175175
}
176176
}
177+
178+
public func stopAnimating() {
179+
isAnimating = false
180+
stackView.arrangedSubviews.compactMap { $0 as? ShimmerReplicatorViewCell }.forEach {
181+
$0.stopAnimating()
182+
}
183+
}
177184
}

ShimmerView/ShimmerReplicatorViewCell.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ import UIKit
55
/// Also, `ShimmerReplicatorView` starts all the cells' animation when its `startAnimating` is called.
66
public protocol ShimmerReplicatorViewCell: UIView {
77
func startAnimating()
8+
func stopAnimating()
89
}

ShimmerViewSamples/ShimmerViewSamples/List/ListViewCell.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,11 @@ class ListViewCell: UIView, ShimmerReplicatorViewCell {
2121
secondLineView.startAnimating()
2222
thirdLineView.startAnimating()
2323
}
24+
25+
func stopAnimating() {
26+
thumbnailView.stopAnimating()
27+
firstLineView.stopAnimating()
28+
secondLineView.stopAnimating()
29+
thirdLineView.stopAnimating()
30+
}
2431
}

0 commit comments

Comments
 (0)