I have been struggling with this for a while. I am trying to have a UIWebview and I keep getting a fatal error which is as follows "fatal error: unexpectedly found nil while unwrapping an Optional value (lldb)". Then in my code it says "Thread 1: EXC_BAD_INTRUCTION(code=EXC_1386_INVOP,subcode 0x0". I do not understand why I keep getting this. Also, I am very new to coding. I will post the code below.
class ViewController: UIViewController {
@IBOutlet var WebView: UIWebView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
let URL = NSURL(string: "http://www.google.com")
WebView.loadRequest(NSURLRequest(URL: URL!))
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}