CocoaPods trunk is moving to be read-only. Read more on the blog, there are 12 months to go.
| TestsTested | ✗ |
| LangLanguage | SwiftSwift |
| License | MIT |
| ReleasedLast Release | Nov 2016 |
| SwiftSwift Version | 3.0 |
| SPMSupports SPM | ✗ |
Maintained by iCodesign.
ICSPullToRefresh-Swift is a Swift version of SVPullToRefresh, providing PullToRefresh && InfiniteScrolling features for UIScrollView
Embedded frameworks require a minimum deployment target of iOS 8.
You can also integrate ICSPullToRefresh directly with souce code. Clone the repo and copy ICSPullToRefresh.swift and ICSInfiniteScrolling.swift to your project.
UIScrollView.addPullToRefreshHandler(() -> ())
Start/Stop animating:
UIScrollView.pullToRefreshView?.startAnimating()
UIScrollView.pullToRefreshView?.stopAnimating()
Trigger manually:
UIScrollView.triggerPullToRefresh()
Hide pulltorefresh:
UIScrollView.setShowsPullToRefresh(Bool)
Since after iOS7, iOS brings
automaticallyAdjustsScrollViewInsetstoUISrollViewembedded in aUINavigationControllerorUITabBarControllerwhich changescontentInsetofUISrollViewbetweenviewDidLoadnadviewDidAppear, so you have to put theaddPullToRefreshHandlerin or afterviewDidAppear
Example:
tableView.addPullToRefreshHandler {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), { () -> Void in
// do something in the background
dispatch_async(dispatch_get_main_queue(), { () -> Void in
self.tableView.pullToRefreshView?.stopAnimating()
})
})
}
UIScrollView.addInfiniteScrollingWithHandler(() -> ())
Start/Stop animating:
UIScrollView.infiniteScrollingView?.startAnimating()
UIScrollView.infiniteScrollingView?.stopAnimating()
Trigger manually:
UIScrollView.triggerInfiniteScrolling()
Hide infiniteScrolling:
UIScrollView.setShowsInfiniteScrolling(Bool)
Since after iOS7, iOS brings
automaticallyAdjustsScrollViewInsetstoUISrollViewembedded in aUINavigationControllerorUITabBarControllerwhich changescontentInsetofUISrollViewbetweenviewDidLoadnadviewDidAppear, so you have to put theaddInfiniteScrollingWithHandlerin or afterviewDidAppear
Example:
tableView.addInfiniteScrollingWithActionHandler {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), { () -> Void in
// do something in the background
dispatch_async(dispatch_get_main_queue(), { [unowned self] in
self.tableView.reloadData()
self.tableView.infiniteScrollingView?.stopAnimating()
})
})
}
Thanks to SVPullToRefresh by Sam Vermette.