Let me reduce what you wrote down to the relevant bits:
{
for index in indexSet {
let chat = chatLog[index]
modelContext.delete(chat)
}
}
You haven't told us what is in chatLog, so we don't know whether you actually remove the deleted item from the array, or whether you repopulate chatLog after deleting the item from modelContext.
Can't really help you unless we know exactly what you're doing.
If chatLog reflects what's in modelContext, then if it shows the deleted item then that item definitely wasn't removed from modelContext.
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags: