You are right that having custom arrays in Core Data consists of creating Core Data objects for these elements and connecting them through relationships just like you did in the chart you published.
How do I proceed (just click "CreateNSManagedObject Subclass ..."?)?
Now that you have an object graph, the next step depends a lot on whether you have Xcode 7 or Xcode 8. In the first case, you have to click the subclass button. Then, if something changes in your data model, you will need to restore the subclasses again.
In the latter (Xcode 8), all you have to do is look at the "Codegen" drop-down menu in the attribute inspector when the object is selected in the Core Data object model file. If you select Class Definition, Xcode 8 should generate a class for you. “Category / Extension” means that it will create an extension with all the code needed to access the master data, and you need to declare the actual definition of the class. In any case (in Xcode 8) they are updated automatically when the object model changes (currently only after the rebuild, and they will not be visible).
Image of WWDC16 Session Master Data

How to read it?
Assuming you haven't set the order in Core Data, it will return as an NSSet , but you can convert it to an array:
reptileInstance.lengths.allObjects as! [Length]
How to add an instance to an array?
You can do something simple:
lengthInstance.reptile = reptileInstance
In this case, lengthInstance will be automatically added to the lengths property of the reptileInstance collection, or you can set the new NSSet to lengths on reptileInstance .
This is a very simplified explanation. You should check the Master Data Programming Guide , but note that it may or may not be updated for the upcoming Xcode 8.
Matthew seaman
source share