How to save related CoreData objects?
riley-usagi opened this issue · comments
Hi, @nalexn .
Could you please explain how to save (store) related objects (Parent -> Childs) to the database?
Thanks.
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)