Apple documentation shows us how we can use an UIRefreshControl
in an UITableViewController
, but do you know, we can add it to any UIScrollView
?
let refreshControl = UIRefreshControl()
refreshControl.addTarget(self, action: #selector(handleRefresh), for: .valueChanged)
scrollView.addSubview(refreshControl)
In a similar way, we can add UIRefreshControl
to a WKWebView
.
let refreshControl = UIRefreshControl()
refreshControl.addTarget(self, action: #selector(handleRefresh), for: .valueChanged)
webView.scrollView.addSubview(refreshControl)