Hey StackOverflow People,
I\'ve been trying to figure out this question for some time now but to no avail and I need some help. I have a UITableView close t
you can make it right with some modification
lazy var refreshControl: UIRefreshControl = {
let refreshControl = UIRefreshControl()
refreshControl.tintColor = UIColor.red
return refreshControl
}()
//refreshControl.addTarget(self, action: #selector(handleRefresh), for: .valueChanged)
every PullToRefresh must have couple lines of code like this, that handleRefresh function, do whatever you need to refresh the page.
you just need to comment out addTarget line and add this function to your code ```
func scrollViewDidScroll(_ scrollView: UIScrollView) {
if scrollView.contentOffset.y < -80 { //change 80 to whatever you want
if !self.refreshControl.isRefreshing {
handleRefresh()
}
}
}
I wrote this code with the help of Ashkan Ghodrat's answer