A custom UIRefreshControl written in Swift with gradient animation.
Exemple:
import UIKit
class ViewController: UIViewController {
@IBOutlet fileprivate weak var tableview: UITableView!
fileprivate lazy var refresh = ATRefreshControl()
override func viewDidLoad() {
super.viewDidLoad()
tableview.delegate = self
tableview.addSubview(refresh)
}
}
extension ViewController: UIScrollViewDelegate {
func scrollViewDidEndDragging(_ scrollView: UIScrollView, willDecelerate decelerate: Bool) {
refresh.containingScrollViewDidEndDragging(scrollView)
}
func scrollViewDidScroll(_ scrollView: UIScrollView) {
refresh.didScroll(scrollView)
}
}
extension ViewController: UITableViewDelegate, UITableViewDataSource {
/*
your implementation here
*/
}
Just drag and drop ATRefreshControl.swift file in your project.
- Add beginRefreshing(), endRefreshing()
- Add custom animation while scroll
MIT