WKWebViewController

class WKWebViewController : UIViewController
extension WKWebViewController: WKUIDelegate
extension WKWebViewController: WKNavigationDelegate

Provides WKWebView hosting support

Public Methods

WKNavigationDelegate

  • Start navigation

    Declaration

    Swift

    func webView(_ webView: WKWebView,
                 // swiftlint:disable:next implicitly_unwrapped_optional
                 didStartProvisionalNavigation navigation: WKNavigation!)

    Parameters

    webView

    Host view

    navigation

    Navigation type

  • Finish navigation

    Declaration

    Swift

    func webView(_ webView: WKWebView,
                 // swiftlint:disable:next implicitly_unwrapped_optional
                 didFinish navigation: WKNavigation!)

    Parameters

    webView

    Host view

    navigation

    Navigation type

  • Fail provisional navigation

    Declaration

    Swift

    func webView(_ webView: WKWebView,
                 // swiftlint:disable:next implicitly_unwrapped_optional
                 didFailProvisionalNavigation navigation: WKNavigation!,
                 withError error: Error)

    Parameters

    webView

    Host view

    navigation

    Navigation type

    error

    Error

  • Fail navigation

    Declaration

    Swift

    func webView(_ webView: WKWebView,
                 // swiftlint:disable:next implicitly_unwrapped_optional
                 didFail navigation: WKNavigation!,
                 withError error: Error)

    Parameters

    webView

    Host view

    navigation

    Navigation type

    error

    Error

  • Handle challenge

    Declaration

    Swift

    func webView(_ webView: WKWebView,
                 didReceive challenge: URLAuthenticationChallenge,
                 completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void)

    Parameters

    webView

    Host view

    challenge

    Challenge

    completionHandler

    Handler

  • Decide navigation policy

    Declaration

    Swift

    func webView(_ webView: WKWebView,
                 decidePolicyFor navigationAction: WKNavigationAction,
                 decisionHandler: @escaping (WKNavigationActionPolicy) -> Void)

    Parameters

    webView

    Host view

    navigationAction

    Action

    decisionHandler

    Handler