Custom compound rows in NSPredicateEditor

159 views Asked by At

Say we have two Core Data entities:

  • entity Bar

    • attribute bar1;
    • attribute bar2;
  • entity Foo

    • attribute foo1;
    • attribute foo2;
    • to-many relationship <Bar*> bars

I want to use NSPredicateEditor to search for "any Foos that have bars with (bar1='term1' and bar2='term2')". That is, multiple matches in the same Bar.

With some kind of custom compound predicate that has a UI like this

Image 1

enter image description here

Image 2

enter image description here

I know how to create top-level NSPredicateEditorRowTemplates to search for Foos based on Bar attributes (Foo.bars.bar1). But those are compounded along with the Foo attribute subpredicates, so I can't limit the search to multiple attributes in the same Bar.

When selecting Bar attributes to search, the list should limit itself to the Bar attributes.

Is it even possible to have multiple types of compound predicates in the same NSPredicateEditor?

Surprisingly little code for customizing NSPredicateEditor out there...

0

There are 0 answers