로컬에 있는 html을 UIWebView 에 로드하는 깔끔한 예제 코드입니다.
먼저, (여기서는 "tempdir") 폴더를 만들어 그속에 html파일과 관련 컨텐츠들을 담아 놓습니다.
해당 폴더를 xcode ide상에 소스코드가 있는 곳으로 드래그&드롭 합니다.
그러면 xcode가 무언가를 묻습니다.
"Copy items if needed" 와 "Create folder references"를 체크합니다.
그리고 ViewController 코드에 아래와 같이 작성하면 로컬의 html을 불러 옵니다.
let localFilePath = Bundle.main.url(forResource: "tempdir/index", withExtension: "html") let request = URLRequest(url: localFilePath!) webView.load(request)
참고: https://stackoverflow.com/questions/55666689/how-to-load-local-html-file-into-uiwebview-with-swift4-2