0
votes

I have a Core Data store, managed by MagicalRecord; one of the attributes is the primary key, but I can't seem to find any docs on how to set it as such (many places talk about the relatedbyattribute, but none say how to set it.

Do I do it programmatically or in XCode (IB)? or?

2

2 Answers

2
votes

You need to look for the User Info area of the attri ute properties inspector. From there, you can enter the relatedBy key and the primary value.

-1
votes

Check the "Indexed" checkbox in the model editor.

enter image description here

While this does not ensure uniqueness, it will speed up the lookup. You will have to check for unique values yourself, as described in this answer.