After deleting all objects in Group, how to update UI ('reload' Query) ?
My function to delete all Group objects, in a Button action in toolbar :
private func deleteAll() {
print("delete all!")
do {
if try modelContext.delete(model: Group.self, where: NSPredicate(value: true), includeSubentities: false) {
print("OK Groups cleared !")
} else {
print("Failed to clear Groups")
}
} catch {
print("error: \(error)")
}
}
Updating attributes in a model triggers an UI/@Query update. But deleting all in code triggers nothing.