Post marked as solved
Click to stop watching this thread.
You have stopped watching this post. Click to start watching again.
contentPostList.repliessolved.tooltip
Replied In
SwiftUI and CoreData
I'm seeing this error in XCode 11 GM seed 1 also. If I access the @FetchRequest in my root View it returns data correctly. If I try to use the same fetch is a child view I get: [SwiftUI] Context in environment is not connected to a persistent store coordinator: <NSManagedObjectContext: 0x2827ac460>. It is like the Environment losses the MOC relationship to the persistent store coordinator in the child views. I think I found a solution for the above issue. I needed to pass the MOC to the child view by adding it to the environment of that view. This allows the FetchRequest in child View (ProspectSelection) to return and not give the above error.ProspectSelection(userData: self.userData, onDismiss: {
self.showingSearchCriteria = false
self.setModelViewData()
}).environment(\.managedObjectContext, CoreDataStack.shared.persistentContainer.viewContext)I thought the purpose the an EnvironmentObject is to safely allow every View to access an Object and not passed around. This does not seem to be working correctly. I may file a bug.For now I'll have to put the MOC in the enviroment of every View that needs a @FetchRequest.