this code JSON not work on swift 3 and i got err in swift 3 how to fix it ?
func dataJsonFromURL(url:String) -> NSArray {
if let data = NSData(contentsOfURL: NSURL(string: url)! as URL) {
return ((try! JSONSerialization.JSONObjectWithData(data, options: [])) as! NSArray)
}
else {
return data
}
}
how to fix it to work in swift 3