Advertisement
Guest User

Untitled

a guest
Apr 25th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. func urlSession(_ session: URLSession, downloadTask: URLSessionDownloadTask, didFinishDownloadingTo location: URL) {
  2.  
  3. do {
  4.  
  5. //JSON資料處理
  6. let dataDic = try JSONSerialization.jsonObject(with: Data(contentsOf: location), options: JSONSerialization.ReadingOptions.mutableContainers) as! [String:[String:AnyObject]]
  7.  
  8. //依據先前觀察的結構,取得result對應中的results所對應的陣列
  9. dataArray = dataDic["StationName"]!["Zh_tw"] as! [AnyObject]
  10.  
  11. //重新整理Table View
  12. self.tableView.reloadData()
  13.  
  14. } catch {
  15. print("Error!")
  16. }
  17.  
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement