SimpleShimmer

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

tableview_shimmer_classic

classic_shimmer_color_no_border

classic_shimmer_color

fade_shimmer

classic_shimmer

Installation

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

Usage

Activate UIView Shimmer in InterfaceBuilder :

activate_shimmer

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
classic_shimmer--1- fade_shimmer--1-
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, [email protected]

GitHub