Get the current full URL for WKWebView

You can get URL for a newly requested Webpage by “navigationAction.request.URL” in decidePolicyForNavigationAction delegate method. func webView(webView: WKWebView, decidePolicyForNavigationAction navigationAction: WKNavigationAction, decisionHandler: (WKNavigationActionPolicy) -> Void) { if let urlStr = navigationAction.request.URL?.absoluteString{ //urlStr is what you want, I guess. } decisionHandler(.Allow) }

In Xcode 14 & iOS 16 purple warnings starting with ‘This method should not be called on the main thread as it may lead to UI unresponsiveness.’

Good in-depth reply from an Apple employee on the forums. The poor interaction between WKWebView, Security framework, and this Xcode feature is a known issue (r. 94019453). We plan to address it at some point but I don’t have any info to share as to when that’ll happen.

tech