WebView does not capture gestures

0

WKWebView loads the link but I can not do anything on the site

ViewController

import UIKit
import WebKit

class promoVC: UIViewController{

@IBOutlet weak var webView: WKWebView!

override func viewDidLoad() {
    super.viewDidLoad()


    webView.navigationDelegate = self
    webView.loadURL(strURL: "https://rh.mazza.tech/web/guest/webuser");
}

}
 extension promoVC : WKNavigationDelegate{

func webView(_ webView: WKWebView, didFailProvisionalNavigation navigation: WKNavigation!, withError error: Error) {
    print(error.localizedDescription)
}

func webView(_ webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!) {
    print("Webview is loading")
}
func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
    print("")
}
}
    
asked by anonymous 05.10.2018 / 14:44

1 answer

0

The webView loadURL method does not compile, you need to use the load

import UIKit
import WebKit

class ViewController: UIViewController {

@IBOutlet weak var webView: WKWebView!

override func viewDidLoad() {
    super.viewDidLoad()

    if let url = URL(string: "https://rh.mazza.tech/web/guest/webuser") {
        webView.load(URLRequest(url: url))
        webView.allowsBackForwardNavigationGestures = true
        webView.navigationDelegate = self
    }
}
}

extension ViewController: WKNavigationDelegate {
func webView(_ webView: WKWebView, didFailProvisionalNavigation navigation: WKNavigation!, withError error: Error) {
     print(error.localizedDescription)
}

func webView(_ webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!) {
     print("Webview is loading")
}

func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
    print("")
}
}
    
11.10.2018 / 21:04