I am downloading HTML source code of a webpage this way:
let url = NSURL(string: "http://www.example.com")
var error: NSError?
let html = NSString(contentsOfURL: url!, encoding: NSUTF8StringEncoding, error: &error)
if (error != nil) {
println("whoops, something went wrong")
} else {
println(html!)
}
But I would like to get it as String instead of NSString. Is there any way?