ObservableObject
can also participate. And NSManagedObject
conveniently conforms to that.
So you can just use @ObservedObject let data: ...
instead of @Binding
. One caveat is that NSManagedObject
triggers update when context successfully save.
You can set NSManagedObjectContext
via environment(_:)
You even have a FetchRequest
as a property wrapper.
Identifiable
can be tricky, but I think ForEach
already handles that (haven’t checked).
I’d say the glue code is mostly already in place.
I wouldn’t advise that. It feels like an easy performance hit. As mentioned above, you can just directly use them with @ObservedObject
instead.