How can i delete all the data in a particular attribute in an entity i don't want to empty all the attributes in the entity here is what i have now which deletes all the attributes in an entity
func deletObject(){
let fetchRequest = NSFetchRequest()
let appDel:AppDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
fetchRequest.includesPropertyValues = false
let context:NSManagedObjectContext = appDel.managedObjectContext
let moc = context
fetchRequest.entity = NSEntityDescription.entityForName("Cart", inManagedObjectContext: moc)
do {
if let results = try moc.executeFetchRequest(fetchRequest) as? [NSManagedObject] {
for result in results {
moc.deleteObject(result)
}
try moc.save()
self.cart = [Cart]()
self.tableView.reloadData()
totalAmouLa.text = "₦\(Int(totalHoursWorkedSum))"
}
} catch {
print("FAILED")
}
}
EDIT
I want to delete delivery in the Cart entity
Image