I'm trying to write a controller with a webview and I need WKNavigationDelegate methods, the problem is that these methods are not being executed at all.
This is my controller:
import UIKit
import WebKit
public class WebViewController: UIViewController {
private let webView: WKWebView = WKWebView()
override public func viewDidLoad() {
super.viewDidLoad()
webView.navigationDelegate = self
webView.isUserInteractionEnabled = true
view = webView
}
}
extension WebViewController: WKNavigationDelegate {
private func webView(_ webView: WKWebView, didCommit navigation: WKNavigation!) {
debugPrint("didCommit")
}
private func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
debugPrint("didFinish")
}
private func webView(_ webView: WKWebView, didFail navigation: WKNavigation!, withError error: Error) {
debugPrint("didFail")
}
}
This controller is being added to a top view controller using a container view, also the webview loads the website correctly. Has anyone had a similar problem or knows if I'm doing something wrong

privatefrom eachDelegatemethods and try.