samvermette/SVPullToRefresh sits at 4.8k stars on GitHub, written primarily in Objective-C. Give pull-to-refresh & infinite scrolling to any UIScrollView with 1 line of code.
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
These UIScrollView categories makes it super easy to add pull-to-refresh and infinite scrolling fonctionalities to any UIScrollView (or any of its subclass). Instead of relying on delegates and/or subclassing UIViewController, SVPullToRefresh uses the Objective-C runtime to add the following 3 methods to UIScrollView:
Add pod 'SVPullToRefresh' to your Podfile or pod 'SVPullToRefresh', :head if you're feeling adventurous.
Manually
Important note if your project doesn't use ARC: you must add the -fobjc-arc compiler flag to UIScrollView+SVPullToRefresh.m and UIScrollView+SVInfiniteScrolling.m in Target Settings > Build Phases > Compile Sources.
Drag the SVPullToRefresh/SVPullToRefresh folder into your project.
[tableView addPullToRefreshWithActionHandler:^{
// prepend data to dataSource, insert cells at top of table view
// call [tableView.pullToRefreshView stopAnimating] when done
}];
or if you want pull to refresh from the bottom
[tableView addPullToRefreshWithActionHandler:^{
// prepend data to dataSource, insert cells at top of table view
// call [tableView.pullToRefreshView stopAnimating] when done
} position:SVPullToRefreshPositionBottom];
If you’d like to programmatically trigger the refresh (for instance in viewDidAppear:), you can do so with:
[tableView triggerPullToRefresh];
You can temporarily hide the pull to refresh view by setting the showsPullToRefresh property:
tableView.showsPullToRefresh = NO;
Customization
The pull to refresh view can be customized using the following properties/methods:
[tableView addInfiniteScrollingWithActionHandler:^{
// append data to data source, insert new cells at the end of table view
// call [tableView.infiniteScrollingView stopAnimating] when done
}];
If you’d like to programmatically trigger the loading (for instance in viewDidAppear:), you can do so with:
[tableView triggerInfiniteScrolling];
You can temporarily hide the infinite scrolling view by setting the showsInfiniteScrolling property:
tableView.showsInfiniteScrolling = NO;
Customization
The infinite scrolling view can be customized using the following methods:
You can access these properties through your scroll view's infiniteScrollingView property.
Under the hood
SVPullToRefresh extends UIScrollView by adding new public methods as well as a dynamic properties.
It uses key-value observing to track the scrollView's contentOffset.
Credits
SVPullToRefresh is brought to you by Sam Vermette and contributors to the project. If you have feature suggestions or bug reports, feel free to help out by sending pull requests or by creating new issues. If you're using SVPullToRefresh in your project, attribution would be nice.
Big thanks to @seb_morel for his Demistifying the Objective-C runtime talk which really helped for this project.
Hat tip to Loren Brichter for inventing pull-to-refresh.
Yes — samvermette/SVPullToRefresh ships under the MIT license, which makes its source code freely readable (and, depending on license terms, forkable and reusable). Source: github.com/samvermette/SVPullToRefresh.
What is samvermette/SVPullToRefresh?
samvermette/SVPullToRefresh (samvermette/SVPullToRefresh) is a Objective-C project on GitHub. From the project's own README: Give pull-to-refresh & infinite scrolling to any UIScrollView with 1 line of code.
Where do I read more about samvermette/SVPullToRefresh?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/samvermette/SVPullToRefresh is the definitive source.
Read full README in the tab above.
Want a second opinion on SVPullToRefresh?
Ask an AI that can read this page — one click and you get its take on SVPullToRefresh.