title: How to apply Local CSS into HTML content in wkWebView Swift
body: <p>I have tried all the solution available on Stack-Overflow
  Couldn't helped out by any solution </p>
  
  <pre><code>extension ViewController: WKNavigationDelegate,WKUIDelegate {
      func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
          self.insertContentsOfCSSFile2(into: webView)
          self.insertContentsOfCSSFile1(into: webView)
      }
  
      func insertContentsOfCSSFile2(into webView: WKWebView) {
          guard let path = Bundle.main.path(forResource: "article-style", ofType: "css") else { return }
          let cssString = try! String(contentsOfFile: path).trimmingCharacters(in: .whitespacesAndNewlines)
          let jsString = "var style = document.createElement('style'); style.innerHTML = '\(cssString)'; document.head.appendChild(style);"
          print(jsString)
          webView.evaluateJavaScript(jsString) {(result, error) in
              if let error = error {
                  print(error)
              }
          }
      }
  
      func insertContentsOfCSSFile1(into webView: WKWebView) {
          guard let path = Bundle.main.path(forResource: "custom", ofType: "css") else { return }
          let cssString = try! String(contentsOfFile: path).trimmingCharacters(in: .whitespacesAndNewlines)
          let jsString = "var style = document.createElement('style'); style.innerHTML = '\(cssString)'; document.head.appendChild(style);"
          print(jsString)
          webView.evaluateJavaScript(jsString) { (result, error) in
              if let error = error {
                  print(error)
              }
              if let result = result {
                  print(result)
              }
          }
      }
  }
  </code></pre>
  
  <p>Here is the web View initialisation </p>
  
  <pre><code>func loadUrl() {
  
      webView = WKWebView(frame: .zero, configuration: WKWebViewConfiguration())
      webView.navigationDelegate = self
      webView.allowsLinkPreview = true
      webView.uiDelegate = self
      webViewContainer.addSubview(webView)
      self.addConstraints(to: webView, with: webViewContainer)
  
      do {
          guard let filePath = Bundle.main.path(forResource: "article", ofType: "html")
              else {
                  print ("FILE READING ERROR")
                  return
          }
          let contents =  try String(contentsOfFile: filePath, encoding: .utf8)
          let baseUrl = URL(fileURLWithPath: filePath)
          print(baseUrl)
          print(contents)
          webView.loadHTMLString(htmlString, baseURL:URL(fileURLWithPath: Bundle.main.bundlePath))
      }
      catch {
          print ("FILE HTML ERROR")
      }
  }
  </code></pre>
  
  <p>"article.html " , "article-style.css" and "custom.css" are the three local file in my project directory </p>
  
  <p>I am calling the webView load request from <code>viewDidLoad()</code> method</p>
  
  <p>There is nothing that I haven't tried but couldn't solved my problem</p>
  
  <p>Any help is greatly appriciated</p>