title: How to preload WKWebView before pushing its viewcontroller?
body: <p>I ask this question because after some research, I haven't found satisfactory answers on the Web.</p>
  
  <p>My need is simple, I have a UITableViewController, when I click on a cell, I need to display a loader (while loading the WKWebViewContent), THEN push the next UIViewController, with the WKWebView already loaded inside.</p>
  
  <p>I tried this : </p>
  
  <pre><code>class TableViewController: UITableViewController, WKNavigationDelegate {
  
     var webviewToLoad:WKWebView!
  
      override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
  
          let htmlString = "some html content"
  
  
          webviewToLoad = WKWebView(frame: .zero, configuration: WKWebViewConfiguration())
          webviewToLoad.navigationDelegate = self
          webviewToLoad.loadHTMLString(htmlString, baseURL: Bundle.main.resourceURL)
      }
  
      override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
  
          if segue.identifier == "postview"{
              let destinationController = segue.destination as! ViewController
              destinationController.webView= webviewToLoad
          }
      }
  
      func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
          print("Loaded!")
          self.performSegue(withIdentifier: "postview", sender: self)
      }
  
  }
  
  class ViewController: UIViewController, WKUIDelegate {
  
      var webView: WKWebView!
  
      override func loadView() {
  
          let webConfiguration = WKWebViewConfiguration()
          webView = WKWebView(frame: .zero, configuration: webConfiguration)
          webView.uiDelegate = self
          self.view = webView
      }
  
      override func viewDidLoad() {
          super.viewDidLoad()
      }
  }
  </code></pre>
  
  <p><code>didFinish</code> is called, but the final WKWebView is blank.</p>
  
  <p>Maybe it isn't the right way, any ideas?</p>