Import SimpleShimmer folder in your project (or use example project)
Activate UIView Shimmer in InterfaceBuilder :
Or programmatically :
myView.withShimmer = true
For a specific (activated) UIView :
myView.startShimmerAnimation()
myView.stopShimmerAnimation()
For all (activated) UIView in UIViewController :
startShimmerAnimation()
stopShimmerAnimation()
For cell in UITableView or UICollectionView :
myTableView.startShimmerAnimation(withIdentifier: "shimmerCell", numberOfRows: 2, numberOfSections: 5)
myTableView.stopShimmerAnimation()
myCollectionView.startShimmerAnimation(withIdentifier: "collectionShimmerCell", numberOfRows: 2, numberOfSections: 5)
myCollectionView.stopShimmerAnimation()
Change animation type :
ShimmerOptions.instance.animationType = .classic
.classic | .fade |
---|---|
Properties | Possible value | Comment |
---|---|---|
animationDuration | CGFloat | Change animation duration |
animationDelay | CGFloat | Delay to restart animation after end |
animationAutoReserse | Bool | Reverse animation |
animationDirection | topBottom, bottomTop, leftRight, rightLeft | Change animation direction (for animation type classic) |
gradientColor | UIColor | Change gradient color (for animation type classic) |
Properties | Possible value | Comment |
---|---|---|
gradientColor | UIColor | Change gradient color (for animation type classic) |
borderWidth | CGFloat | Add border to Shimmer view |
borderColor | UIColor | Change color to Shimmer view |
backgroundColor | UIColor | Change background color to Shimmer view |
Guillian Drouin, [email protected]
SimpleShimmer is available under the MIT license. See the LICENSE file for more info. If you use it, I'll be happy to know about it.