I know about .onDelete modifier, but say I want to remove an item from Coredata using onTapGesture is that possible?
I tried doing
But that didn't go well.
Code Block .onDelete { indexSet in let deleteItem = self.isFavorite[indexSet.first!] self.managedObjectContext.delete(deleteItem) do { try self.managedObjectContext.save() }catch { print(error) } }
I tried doing
Code Block .onTapGesture { indexSet in let deleteItem = self.isFavorite[indexSet.first!] self.managedObjectContext.delete(deleteItem) do { try self.managedObjectContext.save() }catch { print(error) } }
But that didn't go well.