I have an app that uses at WKWebView to display local file paths. It segues to another view controller, then unwinds to the original controller, with a new html file path. I have got it loading the new file path but only after the index file flashes for a second. Anyway to clear this view?
override func viewWillAppear(_ animated: Bool) {
if unwindingFromPost == true {
let htmlPath = Bundle.main.path(forResource: "card/card", ofType: "html", inDirectory: "pickles_ui")
let url = URL(fileURLWithPath: htmlPath!)
let request = URLRequest(url: url)
webView.scrollView.bounces = false
webView.load(request)
} else {
let htmlPath = Bundle.main.path(forResource: "index", ofType: "html", inDirectory: "pickles_ui")
let url = URL(fileURLWithPath: htmlPath!)
let request = URLRequest(url: url)
webView.scrollView.bounces = false
webView.load(request)
}
}
}