Created
April 25, 2017 06:36
-
-
Save helloworldsmart/6aaca08fdd2149bda92306f7814192f4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func urlSession(_ session: URLSession, downloadTask: URLSessionDownloadTask, didFinishDownloadingTo location: URL) { | |
| do { | |
| //JSON資料處理 | |
| let dataDic = try JSONSerialization.jsonObject(with: Data(contentsOf: location), options: JSONSerialization.ReadingOptions.mutableContainers) as! [String:[String:AnyObject]] | |
| //依據先前觀察的結構,取得result對應中的results所對應的陣列 | |
| dataArray = dataDic["StationName"]!["Zh_tw"] as! [AnyObject] | |
| //重新整理Table View | |
| self.tableView.reloadData() | |
| } catch { | |
| print("Error!") | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment