I know how to trigger the event itself, how to, for instance, fill out a form and have the user click button and create a managed object.
What I'm not sure about is how to ensure that objects get created in the right "branch" of the tree.
So for instance, I have multiple projects. Each project can have many ObjectA and many ObjectB, and each ObjectA can have multiple ObjectB. ObjectA may have only one Project, and ObjectB may have only one ObjectA or one Project.
- Project1
- ObjectA
- ObjectB
- ObjectB
- ObjectA
ObjectB
- ObjectA
- Project2
- ObjectB
- ObjectB
I need to be able to instantiate an ObjectA, for instance, under one specific project. I'm not sure how to identify that project. Likewise for ObjectB.
For the bonus, I also need to be able to later click and drag ObjectB into an ObjectA if needed. But right now I'm focused on just getting the tree of objects built and learning how to organize the objects themselves according to the given model.
I am using NSOutlineView to visually represent the objects, and I am using a TreeController to link the OutlineView to the Core Data managed objects. I think that is how it is supposed to work. The book I'm working with doesn't go into very much detail on the actual implementation of all of this. If anyone can suggest a current, thorough book that that does more than just lay out the language itself (like the Apple Swift books do...) that would be awesome. Asking questions in the forum is my last resort.