RPPullDownToRefresh 0.1.2

RPPullDownToRefresh 0.1.2

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Aug 2015
SPMSupports SPM

Maintained by Francesco Petrungaro.



RPPullDownToRefresh

Usage

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

Requirements

  • iOS 8.0+
  • Xcode 6.3
  • Swift 1.2

Installation

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

use_frameworks!
pod "RPPullDownToRefresh"

RPPullDownToRefresh

alt tag

HOW TO USE IT

At first, import RPPullDownToRefresh framework:

import RPPullDownToRefresh

Ccreate the refresh control, add it to your view and provide and provide the end action

class ViewController: UIViewController{

    var refreshControl : PullDownToRefresh?

    override func viewDidLoad() {
        super.viewDidLoad()

        var colors = [UIColor.yellowColor(), UIColor.purpleColor(), UIColor.cyanColor(), UIColor.brownColor()]

        self.refreshControl = PullDownToRefresh(scrollView: self.tableView, marginFromTop : 64, colors : colors)
        self.view.addSubview(self.refreshControl!)
        self.refreshControl?.addTarget(self, action: "refreshData:", forControlEvents: UIControlEvents.ValueChanged)
    }

    func refreshData(sender : AnyObject?){
        let delay = 5 * Double(NSEC_PER_SEC)
        let time = dispatch_time(DISPATCH_TIME_NOW, Int64(delay))
        dispatch_after(time, dispatch_get_main_queue()) {
            self.refreshControl!.stopRefreshing()
        }
    }

Author

Francesco Petrungaro (RedPlumber), [email protected]

License

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