TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Aug 2015 |
SPMSupports SPM | ✗ |
Maintained by Francesco Petrungaro.
To run the example project, clone the repo, and run pod install
from the Example directory first.
RPPullDownToRefresh is available through CocoaPods. To install it, simply add the following line to your Podfile:
use_frameworks!
pod "RPPullDownToRefresh"
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()
}
}
Francesco Petrungaro (RedPlumber), [email protected]
RPPullDownToRefresh is available under the MIT license. See the LICENSE file for more info.