I am trying to load Website Folder from the Document Directory. It’s a PWA Bundle. When i load the Folder from the Bundle, It loads in WkWebview. But when i try to load it from Document Directory, it’s not loading from the folder. May files are missing including main.js, though all those files are there in the bundle(i double checked).
Below is the Sample Code which is not loading.
var url = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!.appendingPathComponent("DownloadedHTMLNew").appendingPathComponent("index.html")
self.webView?.loadFileURL(url, allowingReadAccessTo: url)
Below is the code which is loading from bundle directory.
if let value = Bundle.main.path(forResource: "index", ofType: "html", inDirectory: "DownloadedHTMLNew") {
let url = URL(fileURLWithPath: value)
self.webView?.loadFileURL(url, allowingReadAccessTo: url)
}
Let me know your suggestions.