1

Currently, WKWebView does NOT support loading local file with URLRequest. Details can be read at: this link here

I tried to create a workaround by reading my local html file and use webView.loadHTMLString to manually tell web view to render.

How to I know if webView has loaded with HTML, as if I check webView.URL to see if it has loaded with an URL.

I truly appreciate your help!

Community
  • 1
  • 1
donkey
  • 4,285
  • 7
  • 42
  • 68

1 Answers1

3

You should set your WKWebView navigationDelegate property and then define the delegate method webView:didFinishNavigation:

optional func webView(_ webView: WKWebView,
  didFinishNavigation navigation: WKNavigation!)

which will be called when the main frame load completes.

E.g.,

func webView(webView: WKWebView!, didFinishNavigation navigation: WKNavigation!) {
  println("Finished loading frame")
}
sergio
  • 68,819
  • 11
  • 102
  • 123