How to save related CoreData objects?
riley-usagi opened this issue · 1 comments
riley-usagi commented
Hi, @nalexn .
Could you please explain how to save (store) related objects (Parent -> Childs) to the database?
Thanks.
nalexn commented
Hey @riley-usagi , you simply insert both parent and child objects in the managed context (calling insertNewObject on a concrete NSEntityDescription) and then assign the references between the objects. Here is an example in this repo, where a Country has 1-many relationship with NameTranslation (check out xcdatamodeld file)