SurfingRefreshControl
Customizable pull-to-refresh control,written in pure Swift.
This project is heavily inspired by CBStoreHouseRefreshControl which is Objective-C implemented. SurfingRefreshControl provides you a chance to use pure Swift alternative in your next app.
How to use
Warning:Check out demo app directly if you're too lazy to read
You can attach it to any UIScrollView
( like UITableView
UICollectionView
) :
For instance:
Implement UIScrollViewDelegate
in your UIViewController
to notify SurfingRefreshControl your scrollView's movements:
When you're done with surfing,simply call
How to customize your refresh:
SurfingRefreshControl make use of SurfingBarItem
which actually is a UIView subclass, made of start point and end point to form a line.Imagine a squre need 4 line,thus need 4 SurfingBarItem,which equal to 4 start points and 4 end points.In conclusion,a square surfing refresh control would need a plist file of 4 start points and 4 end points,as shown below:
Square SurfingRefreshControl output is:
PaintCode to generate your startpoints and endpoints without too much hassle: