Skip to content
This repository has been archived by the owner on Sep 9, 2022. It is now read-only.

A pull to refresh control that has a simple, elegant spinner

License

Notifications You must be signed in to change notification settings

joshpc/ElasticPullToRefresh

Repository files navigation

ElasticPullToRefresh

ElasticPullToRefresh is a very simple and slightly customizable pull to refresh control that has a spinner.

pulltorefresh

Usage

Details

Builds using iOS 11.2+, Swift 4.

Installation

Use CocoaPods: pod 'ElasticPullToRefresh'

Code Changes

Import the module where necessary, import ElasticPullToRefresh

Use the ElasticPullToRefresh wrapper to wrap your UIScrollView or UITableView (or anything else that scrolls. Do not manually add that UIScrollView or UITableView to the view hiearchy. Add the ElasticPullToRefresh wrapper instead.

override func loadView() {
  let tableView = UITableView()
  let wrapper = ElasticPullToRefresh(scrollView: tableView)
  view = wrapper
}

Set a didPullToRefresh block. Use this to trigger your downloads. When you're done, call didFinishRefreshing(). That's it!

wrapper.didPullToRefresh = {
  downloadData()
  ...
  //call when done loading
  wrapper.didFinishRefreshing()
}

About

A pull to refresh control that has a simple, elegant spinner

Resources

License

Stars

Watchers

Forks

Packages

No packages published