title: WKWebView is empty if I implement decidePolicyFor navigationAction, loads correctly if I remove the function
body: <p>This is in xcode 10.3, swift 5</p>
  
  <p>I'm trying to load some web content using WKWebView.  I have a class that is just NSObject, which implements the WKNavigationDelegate class.</p>
  
  <ul>
  <li>I create the web view</li>
  <li>Set the navigationDelegate</li>
  <li>Load the web view</li>
  </ul>
  
  <p>If I include this function:  (allow anything)</p>
  
  <pre class="lang-swift prettyprint-override"><code>    public func webView(_ webView: WKWebView,
                          decidePolicyFor navigationAction: WKNavigationAction,
                          decisionHandler: @escaping (WKNavigationActionPolicy) -&gt; Void) {
  
          decisionHandler(.allow)
          return
      }
  </code></pre>
  
  <p>The page just loads an empty html body and nothing is ever displayed.  Also the function never appears to be called this way.</p>
  
  <p>If I comment out that function, the page loads normally.</p>
  
  <p>I am stumped!</p>
  
  <p>I have tried changing my class which contains the webview to be a UIViewController, and then add it to the main controller.  Doing that, the decision handler function does get called, but my webview is still empty.  (it only ever asks for about:blank)</p>
  
  <pre class="lang-swift prettyprint-override"><code>// simplified code
  
  public class MyClass : NSObject, WKUIDelegate, WKNavigationDelegate {
      public func load(container:UIView){
          let config = WKWebViewConfiguration()
          config.allowsInlineMediaPlayback = true
          config.mediaTypesRequiringUserActionForPlayback = WKAudiovisualMediaTypes.init(rawValue: 0)
  
          webView = WKWebView(frame:CGRect(x:0, y:0, width:250, height:250), configuration: config) // test rectangle
          webView!.navigationDelegate = self
          webView!.uiDelegate = self
          webView!.isUserInteractionEnabled = true
          container.addSubview(webView!)
  
          let body = "&lt;div&gt;test&lt;/div&gt;"
          webView!.loadHTMLString(body, baseURL:URL(string:"MY_SITE_HERE"))
      }
  
      public func webView(_ webView: WKWebView,
                          decidePolicyFor navigationAction: WKNavigationAction,
                          decisionHandler: @escaping (WKNavigationActionPolicy) -&gt; Void) {
  
          decisionHandler(.allow)
          return
      }
  }
  
  
  </code></pre>
  
  <p>How this comes about:
  My main view controller has an instance of an NSObject, which does the following simplified:</p>
  
  <pre class="lang-swift prettyprint-override"><code>
  class SDKConsumer : NSObject {
  
  init(parentViewController:ViewController) {
          self.parentViewController = parentViewController
          super.init()
      }
  
  func myFunction(){
          let instance = MyClass()
  
          instance.load(container:parentViewController!.view)
      }
  }
  </code></pre>