relationship coredata

I need help, I'm starting to use CoreData and I have some doubts about the relationship:



I have two entities, Categories and Items:



Category entity has the attributes: name



Items entity has the attributes: name, price, and category (entity attribute name Category)



How do I insert the record in enteidade Items using the entity's name atribuito Category?

Either create the new Category or fetch an existing one by its name. Then set the Category on the Item's category property. Then save.

relationship coredata
 
 
Q