In Swift you can load HTML files into your WKWebView from an file which is part of your App Bundle. Before you use the below code snippet, please make sure that the HTML file you want to display in WKWebView is added to your project.
Load Local HTML File to a WKWebView
let myUrl = myProjectBundle.url(forResource: "my-html-file", withExtension: "html")! myWebView.loadFileURL(myUrl,allowingReadAccessTo: myUrl)
my-html-file – is a name of HTML file you want to load into WKWebView from your App Bundle. Please note there is no need to provide file extention here.
myWebView – is an instance of WKWebView