Inspired by Material design components
Refresher is a simple as UIRefreshControl.
Don't need to add a UIScrollView delegate.
Add the following to your Podfile:
pod"SpringIndicator"use_frameworks!Note: the use_frameworks! is required for pods made in Swift.
Add the following to your Cartfile:
github"KyoheiG3/SpringIndicator"Just add everything in the SpringIndicator.swift file to your project.
If target is ios8.0 or later, please import the SpringIndicator.
import SpringIndicatorAdd Code
letindicator=SpringIndicator(frame:CGRect(x:100, y:100, width:60, height:60))
view.addSubview(indicator)
indicator.startAnimation()Refresher
letrefreshControl=SpringIndicator.Refresher()
refreshControl.addTarget(self, action:"onRefresh", forControlEvents:.ValueChanged)
scrollView.addSubview(refreshControl)Exit refresh
refreshControl.endRefreshing()Can use Interface Builder
@IBInspectablevaranimating:Bool- Start the animation automatically in
drawRect.
@IBInspectablevarlineWidth:CGFloat- Line thickness.
@IBInspectablevarlineColor:UIColor- Line Color.
- Default is
gray.
@@IBInspectablevarlineCap:Bool- Cap style.
- Options are
roundorsquare. true isround. - Default is
false.
@IBInspectablevarlotateDuration:Double- Rotation duration.
- Default is
1.5.
@IBInspectablevarstrokeDuration:Double- Stroke duration.
- Default is
0.7.
letindicator:SpringIndicator- Refresher Indicator.
varrefreshing:Bool- Refreshing status.
func isSpinning()->Bool- During stroke animation is
true.
func startAnimation(expand:Bool= default)- If start from a state in spread is
true.
func stopAnimation(waitAnimation:Bool, completion:((SpringIndicator.SpringIndicator)->Void)?= default)trueis wait for stroke animation.
func strokeRatio(ratio:CGFloat)- between
0.0and1.0.
func endRefreshing()- Must be explicitly called when the refreshing has completed.
Under the MIT license. See LICENSE file for details.



