swiftcore-datansfetchrequestnsarraycontrollernsexpression

Single NSFetchRequest for parent and child objects


I have a list of data with parent-child hierarchy up to three levels. For example

All of the items are located in a single NSArrayController and I want to filter the array by using NSFetchRequest which will result child items and their parents.

For example, if my query matches to ItemC1 and ItemC3 the filtered result should be

All items have parent and children(1-N) properties in order to track the relationships.

Any suggestions will be appreciated.


Solution

  • I have started to use NSOutlineView and NSTreeController in order to create a parent-child hierarchy. I couldn't find another way of grouping and filtering items by using a single dimensioned NSArrayController.