Latest 1.0.0
License MIT
Platforms ios 10.0


A simple Swift implementation of a pull-to-refresh control, for use with UITableView.




Add the PullToRefreshView.swift file to your Xcode project, then follow the steps in the Basic Use section below. This file can be found in the PullToRefreshViewDotSwift/Classes directory.


PullToRefreshView is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "PullToRefreshViewDotSwift"

Basic Use

// Add the control to the table view, 
// and specify what should be done when it's triggered.

self.tableView.installPullToRefreshViewWithHandler { [weak self] (pullToRefreshView) in

    self?.performSomeLongRunningOperation(input, handler: { (output, error) in
        DispatchQueue.main.async {

// To manually trigger the refresh animation.



By default, each call to beginRefreshing() increments an internal counter, and calling endRefreshing() decrements that same counter. This prevents the animation from triggering multiple times if calling beginRefreshing() from more than one function in your code.

To force-hide the view, you can call endRefreshing(force: true), which will reset the counter and hide the view, regardless of any unbalanced calls to begin/end refreshing.

Advanced Use

Custom UI

A UIActivityIndicatorView is used, by default, to mimic UIRefreshControl. However, if you would like to customise your UI, you can add subviews to the public contentView.

// Add some custom UI to the content view.

// Optionally, hide the default UIActivityIndicatorView.
self.tableView.pullToRefreshView()?.spinnerView.isHidden = true


You can set your own animation handlers, as follows:

self.tableView.pullToRefreshView()?.refreshDidStartAnimationHandler = { [weak self] (pullToRefreshView) in
    // Perform some custom animation.

self.tableView.pullToRefreshView()?.refreshDidStopAnimationHandler = { [weak self] (pullToRefreshView) in
    // Stop your custom animation.

Here’s an example custom animation that I use in the Galway Bus Abú app:

alt text

Latest podspec

    "name": "PullToRefreshViewDotSwift",
    "version": "1.0.0",
    "summary": "A simple Swift implementation of a pull-to-refresh control, for use with UITableView.",
    "description": "A simple Swift implementation of a pull-to-refresh control, for use with UITableView.nnWritten as a simple, customizable alternative to UIRefreshControl.",
    "homepage": "",
    "screenshots": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "Vinny Coyne": "[email protected]"
    "source": {
        "git": "",
        "tag": "1.0.0"
    "platforms": {
        "ios": "10.0"
    "source_files": "PullToRefreshViewDotSwift/Classes/**/*",
    "pushed_with_swift_version": "3.0"

Pin It on Pinterest

Share This