Skip to content

SpringIndicator is indicator and PullToRefresh. Inspired by Material design components.

License

Notifications You must be signed in to change notification settings

caotrido/SpringIndicator

 
 

Repository files navigation

SpringIndicator

Carthage Compatibility Version License Platform

  • Refresher is a simple as UIRefreshControl.

  • Don't need to add a UIScrollView delegate.

  • Demo gif
    Indicator Refresher

  • Image capture
    Image

How to Install SpringIndicator

iOS 8+

Cocoapods

Add the following to your Podfile:

pod "SpringIndicator"
use_frameworks!

Note: the use_frameworks! is required for pods made in Swift.

Carthage

Add the following to your Cartfile:

github "KyoheiG3/SpringIndicator"

iOS 7

Just add everything in the SpringIndicator.swift file to your project.

Usage

import

If target is ios8.0 or later, please import the SpringIndicator.

import SpringIndicator

Example

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

Interface Builder

Variable

Indicator

@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 or square. true is round.
  • Default is false.
@IBInspectable var lotateDuration: Double
  • Rotation duration.
  • Default is 1.5.
@IBInspectable var strokeDuration: Double
  • Stroke duration.
  • Default is 0.7.

Refresher

let indicator: SpringIndicator
  • Refresher Indicator.
var refreshing: Bool
  • Refreshing status.

Function

Indicator

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 and 1.0.

Refresher

func endRefreshing()
  • Must be explicitly called when the refreshing has completed.

LICENSE

Under the MIT license. See LICENSE file for details.

About

SpringIndicator is indicator and PullToRefresh. Inspired by Material design components.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 96.4%
  • Ruby 1.9%
  • Objective-C 1.7%