当我尝试追加时,错误显示'无法转换类型的值'字典,字符串,任意>'预期参数类型'CellData'
func downloadBlogDetails(completed: @escaping DownloadComplete) {
Alamofire.request(CURRENT_URL).responseJSON { response in
let result = response.result
if let dict = result.value as? Dictionary<String, Any> {
if let items = dict["items"] as? [Dictionary<String, Any>] {
for obj in items {
if let title = items[0]["title"] as? String {
self._authorName = title
print(self._authorName)
}
if let published = items[0]["published"] as? String {
self._publishedDate = published
print(self._publishedDate)
}
if let author = items[0]["author"] as? Dictionary<String, Any> {
if let name = author["displayName"] as? String {
self._authorName = name
print(self._authorName)
}
}
// add element obj to class array
self.cellData.append(obj)
}
}
}
completed()
}
}