Replies: 1 comment 3 replies
-
Hey @m-housh! Thanks for reaching out. It looks like a bug to me. The fetched item should update its internal token and this should be spotted as an update. I'll check what's going on. As an aside, case let .toggleComplete(todo: todo):
return .run { _ in
await todo.withManagedObject { update in
update.complete.toggle()
try! update.managedObjectContext?.save()
}
}
case .addTodoButtonTapped:
return .run { _ in
await persistentContainer.withNewBackgroundContext {
let newTodo = Todo(context: $0)
newTodo.title = "Finish CoreData"
newTodo.id = uuid()
try! $0.save()
}
} |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Forgive my ignorance with
CoreData
in general, but I'm playing around with the_CoreDataDependency
and trying to determine how to update aFetched
item. I have tried several approaches, mainly the following...This does not update the view / state, however if I shut the app down and restart it, the complete value is toggled. So I'm not sure if I need to invalidate the cached items that have been fetched, but calling my task that initially loads the todo's does not seem to update the todo's state either. Once again, forgive my ignorance in working with core data in general as it seems like there's something basic that I'm missing.
Here's the repository for more complete example.
https://github.com/m-housh/CoreData_Test
Beta Was this translation helpful? Give feedback.
All reactions