MJRefresh
An easy way to use pull-to-refresh.
MJRefresh is a popular iOS library that adds pull-to-refresh and load-more gestures to scroll views, table views, and collection views, saving developers from building this common interaction from scratch.
MJRefresh is a small building block for iOS apps, written mostly in Objective-C. It adds the familiar "pull to refresh" gesture: the action where you drag a list downward to reload it, or pull upward at the bottom to load more items. Many apps you already use have this behavior, and MJRefresh gives developers a ready-made way to add it instead of writing it from scratch.
The README explains which screen elements it can attach to. It works with the standard scrolling views in Apple's toolkit, including plain scroll views, table lists, grid-style collection views, and the web view used to show web pages inside an app. A developer links a refresh control to one of these, and provides the code that should run when the user triggers a refresh, such as loading new data.
Installation is described in a few ways. You can pull it in through CocoaPods or Carthage, which are tools that manage iOS code libraries, or through Swift Package Manager, supported since version 3.7.1. You can also drag the source files into your project by hand and import the main header file. The README lists the files involved and shows short code snippets, including a newer Swift "chaining" style that lets you set up a refresh header in one fluent line.
It also covers some newer features. There is dynamic language switching, so the text shown by the refresh controls can update automatically when the app's language setting changes, with examples for setting the language, the translation file name, and the bundle. Another feature helps the controls flip correctly in layouts that mirror horizontally, which matters for right-to-left languages.
The bulk of the README is a long table of contents pointing to many examples and to documented header files. It shows the class structure: ready-to-use header and footer controls in both plain and animated GIF styles, plus base classes you can inherit from to build your own custom refresh control. The project notes that hundreds of apps use it. In short, this repository is a popular, well-documented helper that saves iOS developers the work of building pull-to-refresh themselves.
Where it fits
- Add a pull-to-refresh header to a UITableView that reloads data from your API when the user drags downward.
- Add a load-more footer to a list that triggers when the user scrolls to the bottom, fetching the next page.
- Build a custom animated refresh control by subclassing the MJRefresh base class and supplying a GIF animation.
- Support right-to-left languages by enabling the built-in horizontal flip so controls display correctly in RTL layouts.