- Refresher is a simple as UIRefreshControl.
- Don't need to add a UIScrollView delegate.
- Swift 5
- iOS 8.0 or later
- tvOS 9.0 or later
Add the following to your Podfile
:
pod "SpringIndicator"
Add the following to your Cartfile
:
github "KyoheiG3/SpringIndicator"
Add Code
let indicator = SpringIndicator(frame: CGRect(x: 100, y: 100, width: 60, height: 60))
view.addSubview(indicator)
indicator.start()
RefreshIndicator
let refreshControl = RefreshIndicator()
refreshControl.addTarget(self, action: "onRefresh", forControlEvents: .ValueChanged)
scrollView.addSubview(refreshControl)
Exit refresh
refreshControl.endRefreshing()
Can use Interface Builder
@IBInspectable var animating: Bool
- Start the animation automatically in
drawRect
.
@IBInspectable var lineWidth: CGFloat
- Line thickness.
@IBInspectable var lineColor: UIColor
- Line Color.
- Default is
gray
.
var lineColors: [UIColor]
- Line Colors.
- Can change some colors during rotation.
- If set,
lineColor
is not used.
@IBInspectable var lineCap: Bool
- Cap style.
- Options are
round
orsquare
. true isround
. - Default is
false
.
@IBInspectable var rotateDuration: Double
- Rotation duration.
- Default is
1.5
.
let indicator: SpringIndicator
- Indicator for refresh control.
var isRefreshing: Bool
- Refreshing status.
var isSpinning: Bool
- During stroke animation is
true
.
func start()
- Start animating.
func stop(with: Bool = default, completion: ((SpringIndicator) -> Swift.Void)? = default)
- Stop animating.
- If true, waiting for stroke animation.
func strokeRatio(_ ratio: CGFloat)
- between
0.0
and1.0
.
func endRefreshing()
- Must be explicitly called when the refreshing has completed.
Follow me 🎉
Under the MIT license. See LICENSE file for details.