title: How to handle redirect website in WebKit
body: <p>I need to recognise redirection url address in <code>WKWebView</code>.</p>
  
  <p>On start in <code>viewDidLoad</code> I create request and load it into <code>webView</code>. It looks like this:</p>
  
  <pre><code>let request = URLRequest(url: URL(string: https://example.com/)!)
  webView.navigationDelegate = self
  webView.load(request)
  </code></pre>
  
  <p>then website in <code>webView</code>redirect me to another website, for example <code>https://www.NEWSITE.com</code> 
  How can I recognise / handle this redirection and print this new url address in my app? Any suggestions?</p>
  
  <blockquote>
    <p>UPDATE:  Solution in delegate method</p>
  </blockquote>
  
  <pre><code>func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -&gt; Void) {
      print(navigationAction.request.url)
      decisionHandler(.allow)
  }
  </code></pre>