let appDelegate = UIApplication.shared.delegate as! AppDelegate
let context = appDelegate.persistentContainer.viewContext
let newOrders = NSEntityDescription.insertNewObject(forEntityName: "Neworders", into: context)
let orda = newOrders
…
тут я разбираю JSON - swiftyJSON
for item in js["orders"].arrayValue {
do {
let newVar = ([item["id"].stringValue])
print(newVar)
orda.setValue(newVar, forKey: "id")
try context.save()
} catch {
//do nothing
}
}
собственно такой вопрос как записать массив в core data