Latest 1.0.0
Homepage https://github.com/arturdev/AMRefresher
License MIT
Platforms ios 9.0
Frameworks UIKit
Authors

Version
License
Platform

Super easy way to use "Pull To Refresh" and "Infinite Scrolling" with 1 line of code

AMRefresher

Installation

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

pod 'AMRefresher'

Or

Copy the AMRefresher folder to your project.

Usage

Adding PullToRefresh and InfiniteScrolling to any UIScrollView is pretty easy:

override func viewDidLoad() {
    super.viewDidLoad()

    //Adding Pull To Refresh
    tableView.am.addPullToRefresh { [unowned self] in
        //Do your heavy job.
        //modify your datasource
        //...
        self.tableView.reloadData() //or insert cells at top of tableView
        self.tableView.am.pullToRefreshView?.stopRefreshing()
    }

    //Adding Infinite Scrolling
    tableView.am.addInfiniteScrolling { [unowned self] in
        //Do your heavy job.
        //append to your datasource
        //...
        self.tableView.reloadData() //or insert cells at bottom of tableView
        self.tableView.am.infiniteScrollingView?.stopRefreshing()
    }
}

If you’d like to programmatically trigger the refresh (for instance in viewDidAppear:), you can do so with:

tableView.am.pullToRefreshView?.trigger()

IMPORTANT NOTE

If you want to change the contentInset of the ScrollView, do that BEFORE adding pullToRefresh or infiniteScrolling.

Customization

Both AMPullToRefreshView and AMInfiniteScrollingView have public method

public func setCustomView(_ view: UIView, for state: AM.State)

So you can call this method and pass any UIView you want to show for each state.

Author

arturdev, [email protected]

Feel free to open issues, feature requests and point bugs/mistakes!

License

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

Latest podspec

{
    "name": "AMRefresher",
    "version": "1.0.0",
    "summary": "Super easy way to use "Pull To Refresh" and "Infinite Scrolling" with 1 line of code",
    "description": "Super easy way to use "Pull To Refresh" and "Infinite Scrolling" with 1 line of code from arturdev",
    "homepage": "https://github.com/arturdev/AMRefresher",
    "screenshots": "https://raw.githubusercontent.com/arturdev/AMRefresher/master/demo.gif",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "arturdev": "[email protected]"
    },
    "source": {
        "git": "https://github.com/arturdev/AMRefresher.git",
        "tag": "1.0.0"
    },
    "platforms": {
        "ios": "9.0"
    },
    "source_files": "AMRefresher/*",
    "swift_version": "4.1",
    "frameworks": "UIKit"
}

Pin It on Pinterest

Share This