GithubHelp home page GithubHelp logo

marty-suzuki / springindicator Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kyoheig3/springindicator

0.0 3.0 0.0 98 KB

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

License: MIT License

Ruby 2.06% Objective-C 1.74% Swift 96.19%

springindicator's Introduction

SpringIndicator

Carthage compatible Version License Platform

  • Refresher is a simple as UIRefreshControl.

  • Don't need to add a UIScrollView delegate.

  • Demo gif
    Indicator Refresher

  • Image capture
    Image

Requirements

  • Swift 3.1
  • iOS 7.0 or later
  • tvOS 9.0 or later

How to Install SpringIndicator

iOS 8+, tvOS

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 rotateDuration: 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) -> Swift.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.

springindicator's People

Contributors

kyoheig3 avatar felipowsky avatar cjwirth avatar morizotter avatar

Watchers

James Cloos avatar Taiki Suzuki avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.