title: Swift 3 - Check if WKWebView has loaded page
body: <p><strong>My question</strong>:
  <em>How do I check if a page in WKWebView has fully loaded in Xcode using Swift 3?</em></p>
  
  <p>This is my problem:</p>
  
  <p><em>Webpage 1:</em> 
  From this page I load Webpage 2</p>
  
  <p><em>Webpage 2:</em>
  I need to get html data from Webpage 2, but when I print the HTML data I get HTML data of webpage 1, which I don't want. But when I print HTML data 2 seconds later it gives me the right HTML data. </p>
  
  <p>I need to know whether or not a page in WKWebView did finish loading. I can see in the WebView it is loaded and also the progressbar is fully loaded, but when I print html data of the page I get html data of previous page, which is not what I want. Only if I wait a second it gives the right data, probably cause Webpage 2 is loaded. </p>
  
  <p>So how do I let Xcode to print html when the next page is totally loaded? </p>
  
  <p>I have tried several methods:</p>
  
  <ul>
  <li><p><a href="https://stackoverflow.com/questions/42797029/detect-wkwebview-finish-loading">detect WKWebView finish loading</a></p></li>
  <li><p><a href="https://stackoverflow.com/questions/24049343/call-javascript-function-from-native-code-in-wkwebview/40730365#40730365">Call JavaScript function from native code in WKWebView</a></p></li>
  </ul>
  
  <p>Maybe I can use:</p>
  
  <p>if webView.isloading { get }
  but I don't know how to implement this method and if it should work.
  I have tried several methods from Stack but these are not working for me or outdated.</p>
  
  <p>Do you guys know a solution for this problem in Swift 3? 
  Thanks!</p>