Member-only story
How to use pull to refresh in Swift?
1 min readNov 14, 2019
You can achieve this by using few lines of code. So why you are going to stuck in third party library or UI. Pull to refresh is built in iOS. You could do this in swift like
var pullControl = UIRefreshControl()
override func viewDidLoad() {
super.viewDidLoad()
pullControl.attributedTitle = NSAttributedString(string: "Pull to refresh")
pullControl.addTarget(self, action: #selector(pulledRefreshControl(_:)), for: UIControl.Event.valueChanged)
tableView.addSubview(pullControl) // not required when using UITableViewController
}
@objc func pulledRefreshControl(sender:AnyObject) {
// Code to refresh table view
}
For more about iOS development : https://medium.com/@javedmultani16
Some useful codes and libraries: https://github.com/javedmultani16
Know more about me: https://www.linkedin.com/in/javedmultani16/