Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When does navigationAction.navigationType == .linkActivated?

In a WKWebView, every time I tap on a URL, the navigationType is .other. When does navigationType equal .linkActivated?

like image 696
ArielSD Avatar asked Oct 03 '17 15:10

ArielSD


1 Answers

Very unlikely. Maybe you are interpreting the raw values wrong?

func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
    print(navigationAction.navigationType.rawValue)
    // -1 "other" seen when assigning the url programatically
    // 0 "linkActivated" a link with an href attribute was tapped
    // 3 "reload" page was refreshed
}

See the docs where you can click on the enumerations listed and and see their raw values

like image 127
Jannie Theunissen Avatar answered Nov 13 '22 01:11

Jannie Theunissen