【发布时间】:2017-02-20 19:13:46
【问题描述】:
我正在尝试在 api 的标签上设置文本,但似乎该函数甚至没有被调用。请参考下面的sn-p。有什么问题吗?
编辑:typealias DownloadComplete = () -> ()
var date: String = ""
override func viewDidLoad() {
super.viewDidLoad()
timeLbl.text = date
// Do any additional setup after loading the view.
}
func downloadTimeData(completed: @escaping DownloadComplete) {
//Downloading forecast weather data for TableView
Alamofire.request(APIURL).responseJSON { response in
let result = response.result
if let dict = result.value as? Dictionary<String, AnyObject> {
if let currentDate = dict["fulldate"] as? String {
self.date = currentDate
print(self.date)
print("xxx")
}
}
completed()
}
}
【问题讨论】:
标签: json swift function api alamofire