Giter VIP home page Giter VIP logo

nvpulltorefresh's Introduction

NVPullToRefresh

PullToRefresh + NVActivityIndicatorView

Language: Swift 4 CocoaPods compatible

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation

NVPullToRefresh is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'NVPullToRefresh'

Animation types

Type Type Type Type
1. ballPulse 2. ballGridPulse 3. ballClipRotate 4. squareSpin
5. ballClipRotatePulse 6. ballClipRotateMultiple 7. ballPulseRise 8. ballRotate
9. cubeTransition 10. ballZigZag 11. ballZigZagDeflect 12. ballTrianglePath
13. ballScale 14. lineScale 15. lineScaleParty 16. ballScaleMultiple
17. ballPulseSync 18. ballBeat 19. lineScalePulseOut 20. lineScalePulseOutRapid
21. ballScaleRipple 22. ballScaleRippleMultiple 23. ballSpinFadeLoader 24. lineSpinFadeLoader
25. triangleSkewSpin 26. pacman 27. ballGridBeat 28. semiCircleSpin
29. ballRotateChase 30. orbit 31. audioEqualizer 32. circleStrokeSpin

Get started

Import NVPullToRefresh

    import NVPullToRefresh
    var refresher = NVPullToRefresh(NVActivityIndicatorType: .circleStrokeSpin, Color: .black)
    
    tableView.addPullToRefresh(refresher) {
            //Do Your Thing Here.
        }

The easiest way to create PullToRefresh:

  let refresher = NVPullToRefresh()

It will create a default pull-to-refresh with a simple view which has single UIActivitiIndicatorView. To add refresher to your UIScrollView subclass:

tableView.addPullToRefresh(refresher) {
    // action to be performed (pull data from some source)
}

⚠️ Don't forget to remove pull to refresh when your view controller is releasing. ⚠️

deinit {
tableView.removePullToRefresh(tableView.topPullToRefresh!)
}

After the action is completed and you want to hide the refresher:

tableView.endRefreshing()

You can also start refreshing programmatically:

tableView.startRefreshing()

But you probably won’t use this component, though. UITableViewController and UICollectionViewController already have a simple type of refresher. It’s much more interesting to develop your own pull-to-refresh control.

Usage in UITableView with sections

Unfortunaly, UITableView with sections currently not supported. But you can resolve this problem in two steps:

  1. Create you own PullToRefresh (see instructions below).
  2. Set its shouldBeVisibleWhileScrolling property to true. It makes you PullToRefresh always visible while you're scrolling the table.

For more Information on PullToRefresh Go to https://github.com/Yalantis/PullToRefresh

For more Information on NVActivityIndicatorView Go to https://github.com/ninjaprox/NVActivityIndicatorView

Author

[email protected], [email protected]

License

NVPullToRefresh is available under the MIT license. See the LICENSE file for more info.

nvpulltorefresh's People

Contributors

satishbabariya avatar

Watchers

 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.