I have the following code:
UIWebView.loadRequest(NSURLRequest(URL: NSURL(string: \"google.ca\")))
I am getting the following error:
Try this:
Add UIWebView to View.
Connect UIWebview outlet using assistant editor and name your "webview".
UIWebView Load URL.
@IBOutlet weak var webView: UIWebView!
override func viewDidLoad() {
super.viewDidLoad()
// Your webView code goes here
let url = URL(string: "https://www.example.com")
let requestObj = URLRequest(url: url! as URL)
webView.load(requestObj)
}
And run the app!!