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
This is worked for me:
@IBOutlet weak var mWebView: UIWebView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
mWebView.loadRequest(NSURLRequest(URL: NSURL(fileURLWithPath: NSBundle.mainBundle().pathForResource("fineName", ofType: "html")!)))
}
Added App Transport Security Settings with Dictionary type in info.plist file. Also added sub key Allow Arbitrary Loads for App Transport Security Settings with type Boolean and value YES.
Here is tutorial.
EDITED
For Swift 3 (Xcode 8)
mWebView.loadRequest(URLRequest(url: URL(fileURLWithPath: Bundle.main.path(forResource: "test/index", ofType: "html")!)))