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
You can load html string or local html file in UIWebView.
HTML string:
func loadHtmlCode() {
let htmlCode = "Wonderful web wonderful web. loading html code in UIWebView>"
webView.loadHTMLString(htmlCode, baseURL: nil)
}
HTML file:
func loadHtmlFile() {
let url = NSBundle.mainBundle().URLForResource("contactus", withExtension:"html")
let request = NSURLRequest(URL: url!)
webView.loadRequest(request)
}
Details can be found here: http://webindream.com/load-html-uiwebview-using-swift/