In my tableViewController I have the following. And I am trying to get delete an item to work.
var myData: Array = []
override func tableV
let entityDescription =
NSEntityDescription.entity(forEntityName: "Contacts",
in: managedObjectContext)
let request: NSFetchRequest = Contacts.fetchRequest()
request.entity = entityDescription
if let result = try? managedObjectContext.fetch(request) {
for object in result {
do {
try managedObjectContext.delete(object)
txtName?.text = ""
txtAddress?.text = ""
txtPhone?.text = ""
Status?.text = "Contact Deleted"
txtName?.text = ""
}
catch let error {
Status?.text = error.localizedDescription
}
}
}