Hey my Friends,
i got a bad problem here. I dont know if this is a bug or i am doing something wrong. I hope anyone can help me here.
For Explain i have several Views with use the same Core Data managedObjectContext. I use this here on WatchOS Beta 9.
My Setup is something like this for Example this:
struct ContentView: View {
@Environment(\.managedObjectContext) var managedObjectContext
...
List {
NavigationLink(destination: DetailView()
.environment(\.managedObjectContext, managedObjectContext)
}
...
...
struct DetailView : View {
@Environment(\.managedObjectContext) var context: NSManagedObjectContext
...
@FetchRequest(
entity: Detail.entity(),
sortDescriptors: [
NSSortDescriptor(keyPath: \Detail.position, ascending: true),
]
) var details: FetchedResults
...
List() {
ForEach(self.details, id: \.objectId) { index in
....
Now my Problem is. When i show the Detail View the first time. Everything is great. I can use onmove, ondelete etc the Entities.
The Cora Data have the correct values.
Now when i got out of the view and go back. The Details will show without Problem BUT
The Connection to the Publisher seems to get lost. I can Debug it with
.onReceive(self.details.publisher) { (store) in
NSLog("[DEBUG] GET CHANGE details \(store)")
}
On First time i can see the Debugs. But Closing the View and Go Back will not show the Debugs anymore.
When using delete onmove etc.
So can anyone tell me what i doing wrong? Have anyone here something similar?
best,
Me