title: Loading local css & js files into WKWebView
body: <p>in Swift 2.1.1 &amp; Xcode 7.1<br>
  My code uses WKWebView and loads index.html form a local file but fails to load index.css and other javascript files as shown in the head tag.</p>
  
  <p>My best guess is that the baseURL is not correct, if so, How can I set the baseURL correctly? Thanks</p>
  
  <pre><code>import UIKit
  import WebKit
  
  class ViewController: UIViewController {
  @IBOutlet var containerView: UIView! = nil  //allows the class to refrence WKWebView
  var webView: WKWebView?
  
  override func loadView() {
      super.loadView()
  
      self.webView = WKWebView()
      self.view = self.webView!
  }
  
  override func viewDidLoad() {
      super.viewDidLoad()
  
      let HTMLDocumentPath = NSBundle.mainBundle().pathForResource("index", ofType: "html")
      let HTMLString: NSString?
  
      do {
          HTMLString = try NSString(contentsOfFile: HTMLDocumentPath!, encoding: NSUTF8StringEncoding)
          let baseUrl  = NSURL.fileURLWithPath("")
          webView!.loadHTMLString(HTMLString as! String, baseURL: baseUrl)
  
      } catch {
          HTMLString = nil
      }
  }
  
  override func didReceiveMemoryWarning() {
      super.didReceiveMemoryWarning()
  }
  </code></pre>
  
  <p>}</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>   &lt;head&gt;
        &lt;meta charset="UTF-8"&gt;
        &lt;title&gt;RRR&lt;/title&gt;
        &lt;link rel="stylesheet" href="jquery.mobile-1.4.5.css"/&gt;
        &lt;link rel="stylesheet" href="index.css"/&gt;
        &lt;script src="jquery-1.11.3.js"&gt;&lt;/script&gt;
        &lt;script src="jquery.mobile-1.4.5.js"&gt;&lt;/script&gt;
        &lt;meta name="viewport" content="width=device-width"/&gt;
     &lt;/head&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p><a href="https://i.stack.imgur.com/jyLSk.png" rel="noreferrer"><img src="https://i.stack.imgur.com/jyLSk.png" alt="enter image description here"></a></p>