I'm using an API that gives me data in a neat format - How do I get this as a String
? I can print it, but saving it as a string doesn't seem to work.
I specifically want to update a UI element using the data from the NSURLSession
task.
let url = NSURL(string: apiCall)
let task = NSURLSession.sharedSession().dataTaskWithURL(url!) {(data, response, error) in
//I want to replace this line below with something to save it to a string.
println(NSString(data: data, encoding: NSUTF8StringEncoding))
}
task.resume()