【发布时间】:2021-04-10 17:41:23
【问题描述】:
试图从结果中获取价值。有人知道如何解决吗?也许其他的一些其他解决方案。
func downloadForecastWeather(completed: @escaping DownloadComplete) {
Alamofire.request(FORECAST_API_URL).responseJSON { (response) in
let result = response.result
if let dictionary = result.value as? Dictionary<String, AnyObject> { // There is an error.
if let list = dictionary["list"] as? [Dictionary<String, AnyObject>] {
for item in list {
let forecast = ForecastWeather(weatherDict: item)
self.forecastArray.append(forecast)
}
self.forecastArray.remove(at: 0)
self.tableView.reloadData()
}
}
completed()
}
}
}
【问题讨论】: