"NSURL" is not implicitly convertible to "URL"; did you mean to use "as" to explicitly convert?
In swift 3 you need to use URL
instead of NSURL
, so create url object like this.
if let url = URL(string: "https://www.google.com") {
webView.load(URLRequest(url: url))
}
Update for Swift 3.1:
let url = URL(string: "https://www.google.com")
let request = URLRequest(url: url!)
webView.load(request)
Notice the use of URL
instead of NSURL
and load
instead of loadRequest
.