explaingit

codermjlee/mjrefresh

13,821Objective-CAudience · developerComplexity · 2/5Setup · easy

TLDR

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.

Mindmap

mindmap
  root((MJRefresh))
    What it does
      Pull to refresh
      Load more footer
      Custom controls
    Supported views
      ScrollView
      TableView
      CollectionView
      WebView
    Installation
      CocoaPods
      Carthage
      Swift Package Manager
    Features
      GIF animations
      Language switching
      RTL layout support
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Add a pull-to-refresh header to a UITableView that reloads data from your API when the user drags downward.

USE CASE 2

Add a load-more footer to a list that triggers when the user scrolls to the bottom, fetching the next page.

USE CASE 3

Build a custom animated refresh control by subclassing the MJRefresh base class and supplying a GIF animation.

USE CASE 4

Support right-to-left languages by enabling the built-in horizontal flip so controls display correctly in RTL layouts.

Tech stack

Objective-CSwiftCocoaPodsCarthage

Getting it running

Difficulty · easy Time to first run · 5min

Add via CocoaPods, Carthage, or Swift Package Manager, no external dependencies or API keys required.

License is not stated in the available content.

In plain English

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.

Copy-paste prompts

Prompt 1
I have a UITableView in my iOS app and want pull-to-refresh. Show me the Swift code to set up an MJRefresh header that calls my API and stops the animation when the data loads.
Prompt 2
How do I add a load-more footer with MJRefresh to my UICollectionView that triggers a network call when the user reaches the bottom of the list?
Prompt 3
How do I replace MJRefresh's default spinner with a custom GIF animation in the pull-to-refresh header?
Prompt 4
My iOS app supports both English and Arabic. How do I configure MJRefresh to switch its refresh text labels automatically when the app language changes?
Prompt 5
Show me how to install MJRefresh using Swift Package Manager and import it in a Swift UIViewController.
Open on GitHub → Explain another repo

← codermjlee on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.