Skip to content

Repository files navigation

SpringIndicator

Carthage CompatibilityVersionLicensePlatform

  • Refresher is a simple as UIRefreshControl.

  • Don't need to add a UIScrollView delegate.

  • Demo gif
    IndicatorRefresher

  • 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

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

Interface Builder

Variable

Indicator

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

Refresher

letindicator:SpringIndicator
  • Refresher Indicator.
varrefreshing: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

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages