title: WKWebView target="_blank" link open new tab in safari ios11, swift 4
body: <p>I understand this question has been asked a lot and I think I have viewed every single post about this and I still cannot get this to work. I'm new to swift and I think that is inhibiting me from being able to adapt code snippets from other answers. </p>
  
  <p>So here's my question:</p>
  
  <p>I am using a WKWebView to view a website in my app. When I click on a link that opens a new tab  nothing happens. I want that new tab to open in safari or at least in a new wkwebview. I've tried implementing this answer from: <a href="https://stackoverflow.com/a/27391215">https://stackoverflow.com/a/27391215</a>, and <a href="https://stackoverflow.com/q/30603671/5881352">Open a WKWebview target=&quot;_blank&quot; link in Safari</a> and many other similar answers, but am making no progress. What do I need to do to make this work in swift 4?</p>
  
  <p>Currently I just have this since I wasn't able to implement any of the other solutions I found successfully:</p>
  
  <pre><code>func webView(_ webView: WKWebView, createWebViewWith configuration: WKWebViewConfiguration, for navigationAction: WKNavigationAction, windowFeatures: WKWindowFeatures) -&gt; WKWebView? {
      if navigationAction.targetFrame == nil {
          webView.load(navigationAction.request)
      }
      return nil
  }
  </code></pre>
  
  <p>But it doesn't seem to do anything. If someone could help point me in the right direction I would really appreciate it.</p>