Thursday, August 11, 2022
HomeiOS Developmentios - SwiftUI CoreData confused a couple of couple issues

ios – SwiftUI CoreData confused a couple of couple issues

So I am watching Paul Hudson’s movies about CoreData but it surely’s truthfully nonetheless complicated to me and even studying on Apple’s documentation it is exhausting to know what I am doing right here and what’s 100% happening.

So the very first thing that’s executed on this video is we make a xcdatamodel file, this is smart it is simply the definition for no matter information we wish to retailer.
Then he makes a DataController class with a container which is a NSPersistentContainer with the identify argument being regardless of the identify of my xcdatamodel was, I do not absolutely perceive this what precisely is the container for? Apple says it simply units every part up(An occasion of NSPersistentContainer units up the mannequin, context, and retailer coordinator unexpectedly.) So I suppose that is that?

Then an init() is made and container.loadPersistentStores is named, what precisely is that this and what are the persistent shops? I suppose that is simply loading the info however unsure.

Then within the Scene we name .surroundings(.managedObjectContext, dataController.container.viewContext) what precisely is that this doing? Apparently we’re simply injecting the viewContext into the managedObjectContext or one thing truthfully unsure what’s the managedObjectContext what’s the viewContext?

Then lastly in some recordsdata



Please enter your comment!
Please enter your name here

Most Popular

Recent Comments