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 SpringIndicator
Add Code
let indicator = SpringIndicator(frame: CGRect(x: 100, y: 100, width: 60, height: 60))
view.addSubview(indicator)
indicator.startAnimation()
Refresher
let refreshControl = SpringIndicator.Refresher()
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
.
@@IBInspectable var lineCap: Bool
- Cap style.
- Options are
round
orsquare
. true isround
. - Default is
false
.
@IBInspectable var lotateDuration: Double
- Rotation duration.
- Default is
1.5
.
@IBInspectable var strokeDuration: Double
- Stroke duration.
- Default is
0.7
.
let indicator: SpringIndicator
- Refresher Indicator.
var refreshing: 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)
true
is wait for stroke animation.
func strokeRatio(ratio: CGFloat)
- between
0.0
and1.0
.
func endRefreshing()
- Must be explicitly called when the refreshing has completed.
Under the MIT license. See LICENSE file for details.