WkWebView won't loadHTMLstring

SWIFT

You might be making it a bit too complicated. This worked for me ...

First, import WebKit

Second, create an @IBOutlet under your class:

@IBOutlet weak var webView: WKWebView!

Third, place the following in your viewDidLoad():

let htmlString:String! = "\(YourString)"
webView.loadHTMLString(htmlString, baseURL: NSBundle.mainBundle().bundleURL)

SWIFT 3 update

webView.loadHTMLString(htmlString, baseURL: Bundle.main.bundleURL)

I met the same problem as you! The key problem is in the project settings:

Check your Xcode Project > Target > Capabilities > App Sandbox.

Make sure you've CHECKED the NetWork ✅ Incoming & ✅ Outgoing connections.

See the SreenShot Below:

enter image description here