Latest 0.1.0
License MIT
Platforms ios 8.0

A easy way to pull to refresh, Thanks for MJRefresh

CI Status





File Structures


[How to use ](#How_to_use )




To run the example project, clone the repo, and run pod install from the Example directory first.


  • iOS >= 8.3
  • Swift >= 3.0


  • TTARefresher is available through CocoaPods. To install
    it, simply add the following line to your Podfile:pod "TTARefresher"

  • Manual import:

    Drag All files in the MJRefresh folder to project, import the main file:import TTARefresher

File Structures

        |- TTARefresherHeader
        |       |
        |       |- TTARefresherStateHeader
        |               |
        |               |- TTARefresherNormalHeader (DIRECTLY USE)
        |               |
        |               |- TTARefresherGifHeader (DIRECTLY USE)
        |- TTARefresherFooter
                |- TTARefresherAutoFooter
                |       |
                |       |- TTARefresherAutoStateFoote
                |               |
                |               |- TTARefresherAutoNormalFooter (DIRECTLY USE)
                |               |
                |               |- TTARefresherAutoGifFooter (DIRECTLY USE)
                |- TTARefresherBackFooter
                        |- TTARefresherBackStateFoote
                                |- TTARefresherBackNormalFooter (DIRECTLY USE)
                                |- TTARefresherBackGifFooter (DIRECTLY USE)


Name Space

/// For the Instance Methods
public var ttaRefresher: TTARefresher.TTARefresherProxy<Self>

// /For the Static Methods
public static var TTARefresher: TTARefresher.TTARefresherProxy<Self>.Type 

/// Refresher Header    
public var header: TTARefresher.TTARefresherHeader?

/// Refresher Footer
public var footer: TTARefresher.TTARefresherFooter?

/// Data Count in total
public var totalDataCount: Int

Refresher States

    public enum TTARefresherState : Int {
        /// Normal State
        case idle

        case pulling

        case refreshing

        case willRefresh

        case noMoreData


    /// Refresher State
    open var state: TTARefresher.TTARefresherState

    /// Whether the Refresher is Refreshing
    public var isRefreshing: Bool

    /// Current pulling Percentage
    open var pullingPercent: CGFloat

    /// Whether Auto Change the Refresher Alpha
    public var isAutoChangeAlpha: Bool

    /// The Refresher's superView, Readonly for subviews
    public fileprivate(set) var scrollView: UIScrollView?

    /// The ScrollView Original inset, Readonly for subviews
    public internal(set) var scrollViewOriginalInset: UIEdgeInsets

    /// Refresher Targer
    public var refreshingTarget: AnyObject?

    /// Refresher Action
    public var refreshingAction: Selector?

    /// Refresher Handler
    public var refreshingHandler: TTARefresher.TTARefresherComponentRefreshingHandler?

    /// Excuate While Begin Refreshing Completed
    public var beginRefreshingCompletionHandler: TTARefresher.TTARefresherComponentBeginCompletionHandler?

    /// Excuate While End Refreshing Completed
    public var endRefreshingCompletionHandler: TTARefresher.TTARefresherComponentEndCompletionHandler?

    /// Set Refreshing Target and Action
    public func setRefreshingTarget(aTarget: AnyObject, anAction: Selector)

    /// Begin Refreshing
    public func beginRefreshing(_ completionHandler: TTARefresher.TTARefresherComponentBeginCompletionHandler? = default)

    /// End Refreshing
    public func endRefreshing(_ completionHandler: TTARefresher.TTARefresherComponentEndCompletionHandler? = default)


    /// Refresher Header State Label
    lazy public var stateLabel: UILabel

    /// Refresher Header Time Label
    public var lastUpdatedTimeLabel: UILabel

    /// The margin between Label and left images
    public var labelLeftInset: CGFloat

    /// Set Custom Titles for State
    public func set(title: String, for state: TTARefresher.TTARefresherState)


    /// If true, the footer will be shown when there are data, otherwise, footer will be hidden
public var isAutoHidden: Bool

    /// The ContentInset Bottom to ignore
    public var ignoredScrollViewContentInsetBottom: CGFloat

    /// Rest Refresher state `.noMoreData` to `.idle`
    public func resetNoMoreData()

    /// End Refresher and Set State With `.noMoreData`
    public func endRefreshWithNoMoreData()

TTARefresherAutoFooter & TTARefresherBackFooter

    /// Whether Footer Auto Refresh
    public var isAutoRefresh: Bool

    /// The percent when the footer appear will get refresh, default is 1.0
    public var triggerAutoRefreshPercent: CGFloat

    /// Whether Hide Footer
    open var isHidden: Bool

TTARefresherAutoStateFoote & TTARefresherBackStateFooter

    /// State Label
    open var stateLabel: UILabel

    /// Set Custom Titles for state
    public func set(title: String, for state: TTARefresher.TTARefresherState)

    /// Title for state
    public func title(for state: TTARefresher.TTARefresherState) -> String?

TTARefresherAutoNormalFooter & TTARefresherBackNormalFooter & TTARefresherNormalHeader

    /// Refresher Footer/ Header Indicator Style, default is `.gray`
    public var indicatorStyle: UIActivityIndicatorViewStyle

    /// Back Normal Footer's Arrow Image View
    public var arrowImageView: UIImageView

TTARefresherAutoGifFooter & TTARefresherBackGifFooter & TTARefresherGifHeader

    /// Gif Image View
    open var gifImageView: UIImageView

    /// Set Images And Animation Time for State
    public func set(images: [UIImage]?, duration: TimeInterval?, for state: TTARefresher.TTARefresherState)

    /// Set Images For State, Default Time is `images.count * 0.1`
    public func set(images: [UIImage]?, for state: TTARefresher.TTARefresherState)

extension TTARefresherComponent {

    open func prepare()

    open func placeSubviews()

    open func scrollViewContentSizeDidChange(_ change: [NSKeyValueChangeKey : Any]?)

    open func scrollViewContentOffsetDidChange(_ change: [NSKeyValueChangeKey : Any]?)

    open func scrollViewPanStateDidChange(_ change: [NSKeyValueChangeKey : Any]?)

How to use


Default Header

    let header = TTARefresherNormalHeader {
   // or
   let header = TTARefresherNormalHeader(refreshingTarget: self, refreshingAction: #selector(loadNew))

Default Header

Gif Header

    let header = TTARefresherGifHeader {
   // or
    let header = TTARefresherGifHeader(refreshingTarget: self, refreshingAction: #selector(loadNew))
   // The margin between label and images
   header.labelLeftInset = 10
   let (idleImages, refreshingImages) = prepareAnimationImages()
   header.set(images: idleImages, for: .idle)
   header.set(images: refreshingImages, for: .refreshing)

Gif Header

Header Hide Time

    header.lastUpdatedTimeLabel.isHidden = true

Header Hide Time

Header Hide Time And State

    header.stateLabel.isHidden = true
    header.lastUpdatedTimeLabel.isHidden = true

Header Hide Time And State

Header Custom Text

    header.set(title: "Pull Me Down", for: .idle)
    header.set(title: "Release Me To Refresh", for: .pulling)
    header.set(title: "Come on, I'm getting the data", for: .refreshing)

Header Hide Time And State


Footer Default Auto

    let footer = TTARefresherAutoNormalFooter {
   // or
   let footer  = TTARefresherAutoNormalFooter(refreshingTarget: self, refreshingAction: #selector(endLoadMore))

Footer Default Auto

Auto Gif Footer

    let footer = TTARefresherAutoGifFooter {
   // or
    let footer = TTARefresherAutoGifFooter(refreshingTarget: self, refreshingAction: #selector(loadMore))
    let (idleImages, refreshingImages) = prepareAnimationImages()
    footer.set(images: idleImages, for: .idle)
    footer.set(images: refreshingImages, for: .refreshing)

Auto Gif Footer

Back Footer

    let footer = TTARefresherBackNormalFooter {
    // or
    let footer = TTARefresherBackNormalFooter(refreshingTarget: self, refreshingAction: #selector(loadMore))

Back Footer

Auto Gif Hide State

    footer.stateLabel.isHidden = true

Auto Gif Hide State


TobyoTenma, [email protected]


TTARefresher is available under the MIT license. See the LICENSE file for more info.

Latest podspec

    "name": "TTARefresher",
    "version": "0.1.0",
    "summary": "TTARefresher is Swift version of `MJRefresh`",
    "description": "TTARefresher is Swift version of `MJRefresh`, TTARefresher can work with UIScrollView, UITableView, UICollectionView and UIWebView, WKWebView. Othewise, THANKS the author of `MJRefresh`",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "TMTBO": "[email protected]"
    "source": {
        "git": "",
        "tag": "0.1.0"
    "platforms": {
        "ios": "8.0"
    "source_files": "TTARefresher/Classes/**/*",
    "resource_bundles": {
        "TTARefresher": [
    "pushed_with_swift_version": "3.1"

Pin It on Pinterest

Share This