/ATRefreshControl

Custom UIRefreshControl in Swift.

Primary LanguageSwift

ATRefreshControl

A custom UIRefreshControl written in Swift with gradient animation.

N|Solid

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
	*/
}

Installation

Just drag and drop ATRefreshControl.swift file in your project.

Todos

  • Add beginRefreshing(), endRefreshing()
  • Add custom animation while scroll

License

MIT