Skip to content

Repository files navigation

SpringIndicator

Carthage compatibleVersionLicensePlatform

  • Refresher is a simple as UIRefreshControl.
  • Don't need to add a UIScrollView delegate.

IndicatorRefresher

Image

Requirements

  • Swift 5
  • iOS 8.0 or later
  • tvOS 9.0 or later

How to Install SpringIndicator

Cocoapods

Add the following to your Podfile:

pod"SpringIndicator"

Carthage

Add the following to your Cartfile:

github"KyoheiG3/SpringIndicator"

Swift Package Manager

To install BulletinBoard using the Swift Package Manager, add this dependency to your Package.swift file:

.package(url:"https://github.com/KyoheiG3/SpringIndicator.git", from:"5.1.0")

Usage

Example

Add Code

letindicator=SpringIndicator(frame:CGRect(x:100, y:100, width:60, height:60))
view.addSubview(indicator)
indicator.start()

RefreshIndicator

letrefreshControl=RefreshIndicator()
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.
varlineColors:[UIColor]
  • Line Colors.
  • Can change some colors during rotation.
  • If set, lineColor is not used.
@IBInspectablevarlineCap:Bool
  • Cap style.
  • Options are round or square. true is round.
  • Default is false.
@IBInspectablevarrotateDuration:Double
  • Rotation duration.
  • Default is 1.5.

RefreshIndicator

letindicator:SpringIndicator
  • Indicator for refresh control.
varisRefreshing:Bool
  • Refreshing status.

Function

Indicator

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

Refresher

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

Author

Kyohei Ito

Follow me 🎉

LICENSE

Under the MIT license. See LICENSE file for details.

About

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

Resources

Stars

271 stars

Watchers

6 watching

Forks

Releases

Packages

Contributors

Languages