Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mellonglau/cocorongpulltorefresh
A simple pull to refresh component for iOS written in Swift.
https://github.com/mellonglau/cocorongpulltorefresh
ios swift swift3
Last synced: 8 days ago
JSON representation
A simple pull to refresh component for iOS written in Swift.
- Host: GitHub
- URL: https://github.com/mellonglau/cocorongpulltorefresh
- Owner: MellongLau
- License: mit
- Created: 2017-03-08T12:29:52.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-10-18T00:00:16.000Z (29 days ago)
- Last Synced: 2024-10-31T20:39:35.492Z (15 days ago)
- Topics: ios, swift, swift3
- Language: Swift
- Size: 271 KB
- Stars: 7
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CocoRongPullToRefresh
*Like this project?* `Star us above!`
Pull to refresh is one of most frequently feature to be used in the all of apps, this component provides a easiest way to add pull to refresh feature for your table view.
![Screenshot](./screenshot/screenshot.gif)
### Languages
[中文](./README_CN.md)
### Usage
* There is a sample to demonstrate how to use this component easily.
```swift
tableView.cr.enablePullRefresh { [weak self] in
guard let self else { return }
// Call data api from remote server.
get("http://xxx.com/api/productlist") { dataList in
// Update table view datasource
self.tableView.datasource = dataList
self.tableView.reloadData()
// Finish refresh
self.tableView.cr.stopRefresh()
}
}
```As you saw above, we can simply enable this component for our table view, we may need to configure the tint color of the pull refresh view's background by:
```swift
tableView.cr.tintColor = UIColor.brown
```Finally, we should call the `remove()` method in the view controller's `deinit`
```swift
deinit {
tableView.cr.remove()
}
```
### Usage ExampleCheck out the Sample project in the example directory to see more.
### Installation
There are two approach to add `CocoRongPullToRefresh` to your exist project.#### CocoaPods
[CocoaPods](http://www.cocoapods.org) is the recommended way to add CocoRongPullToRefresh to your project.
1. Add additional entry to your Podfile.
```ruby
pod "CocoRongPullToRefresh", "~> 1.1.3"
```2. Install Pod(s) running `pod install` command.
3. Include CocoRongPullToRefresh using `import CocoRongPullToRefresh `.#### Manual Install
Run below command in Terminal.app:
$ git clone https://github.com/MellongLau/CocoRongPullToRefresh.git
or download directly, then copy `CocoRongPullToRefresh` folder and add reference to your project.
### Requirements
Requires Swift 5.0+ and iOS 12.0+.
### Using CocoRongPullToRefresh?
If you're using CocoRongPullToRefresh in one of your own projects, let me know! I'll add a link to your profile/website/app right here on the front page. Feel free to email me at the address shown below.
### Contributing
Forks, patches and other feedback are welcome.### Creator
I'm Mellong, you can contact me by E-Mail:### License
MIT License