• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: Core Data results with @EnvironmentKey

Resolved: Core Data results with @EnvironmentKey

0
By Isaac Tonny on 18/06/2022 Issue
Share
Facebook Twitter LinkedIn

Question:

i try to adopt answer from How to re-use the same FetchRequest, rather than the same request in several views?
i build simple app with Core data
in @main i getting warning Context in environment is not connected to a persistent store coordinator: <NSManagedObjectContext: 0x60000273dfb0> the code from sample @ObservedObject var persistenceManager = PersistenceManager(usage: .main) generate error also, i understand that i need to connect my core data store to environment
thanks for help in advance

Answer:

.loadCounts() is applied as a modifier outside (after) the modifier that sets the managed object context in the environment. This means the environment value is not present in your modifier’s body. Try moving .loadCounts() above .environment(\.managedObjectContext, ...).

If you have better answer, please add a comment about this, thank you!

core-data swiftui
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: TypeScript does not recognize properties when instantiating interface array

27/03/2023

Resolved: How to make statement case insensitive when uploading a dta file with specified columns?

27/03/2023

Resolved: Sort dataframe columns value by close it to another column

27/03/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.