This one is driving me crazy early this morning. I want to load some local html into a web view:
class PrivacyController: UIViewController {
@IBOutlet w
Swift 4.2, Xcode 10.1, WKWebView load HTML from file. UIWebView is deprecated.
In apps that run in iOS 8 and later, use the WKWebView class instead of using UIWebView.
import WebKit
@IBOutlet weak var webView: WKWebView!
override func viewDidLoad() {
super.viewDidLoad()
let localFilePath = Bundle.main.url(forResource: "document_terms_of_use", withExtension: "html")
let request = NSURLRequest(url: localFilePath!)
webView.load(request as URLRequest)
}