Very simple Shimmer loader for all View, TableView or CollectionView

SimpleShimmer

Very simple Shimmer loader for all View, TableView or CollectionView !

Installation

Import SimpleShimmer folder in your project (or use example project)

Usage

Activate UIView Shimmer in InterfaceBuilder :

Or programmatically :

myView.withShimmer = true

Start shimmer

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()

ShimmerOptions

Change animation type :

ShimmerOptions.instance.animationType = .classic
.classic .fade
Animation properties :
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)
Shimmer style :
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

Author

Guillian Drouin, drouingui@gmail.com

GitHub