Trying to create a webview controller in Swift 3. On the last line of the viewDidLoad() function, I am getting the error Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value.
As far as I can tell, this error should only happen if something isn't set, but webView is set, loadRequest exists, and the request variable exists. Am I not wrapping something correctly? Or has the syntax changed somewhere?
@IBOutlet weak var webView: UIWebView!
override func viewDidLoad() {
super.viewDidLoad()
let url = URL (string: "https://example.com");
let request = URLRequest(url: url!);
webView.loadRequest(request);
}
I haven’t found anything that explained exactly what was going on well. I tried to document as best as I was able.
This does not appear to be related to the wrapping issue.