I am trying to load HTML content from this website onto a Webview. But I am getting the following error:
Cannot convert value of type 'NSString?' to expected argument type 'String'
Here is my code:
override func viewDidLoad() {
super.viewDidLoad()
let webUrl = NSURL(string: "http://www.stackoverflow.com/users/5438240/naishta")
let webContent = NSURLSession.sharedSession().dataTaskWithURL(webUrl!){
(data,response,error) in
if error == nil{
let readableForm = NSString(data: data!, encoding: NSUTF8StringEncoding)
print(readableForm)
self.displayWeb.loadHTMLString(readableForm, baseURL: nil) //here is where the error is thrown
}
}
webContent.resume()
}