Hey guys!
Estou com um problema aparentemente bem besta, porém estou quebrando a cabeça:
Tenho um Array de objetos, e recebo um JSON com um array, eu precisava simplesmente fazer um for para pegar os itens e estou recebendo esse error: NSArray element failed to match the Swift Array Element type
static func converJSON(json: NSDictionary) -> Data {
print("----------------------- JSON RESPONSE -----------------------")
let data: Data = Data()
data.id = json["id"] as! Int
data.message = json["message"] as! String
data.description = json["description"] as! String
data.dataItem = json["dataItem"] as! Array // <<<<<<<<<<<<<<<<<
print(data.dataItem.count)
print(json["dataItem"])
for item in data.dataItem {
}