Trying to achieve the option to refresh the WebView URL with no success, so far I have this
class ViewController2: UIViewController {
@IBOutlet var webview2: WKWebView!
override func viewDidLoad() {
super.viewDidLoad()
webview2.load(URLRequest(url: URL(string: "https://coinmarketcap.com/")!))
}
//Pull to Refresh
func scrollViewWillEndDragging(_ scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer<CGPoint>) {
if (scrollView.contentOffset.y < 0){
//reach top
print("Reach Top")
webview2.reload()
}
}
}
Someone can tell me why it doesn't work? I'm new on this