NSArrayController that is sorted and unique (no duplicates) for use in a pop-up in a core-data app
Posted
by Douglas Weaver
on Stack Overflow
See other posts from Stack Overflow
or by Douglas Weaver
Published on 2010-05-08T00:05:59Z
Indexed on
2010/05/08
0:08 UTC
Read the original article
Hit count: 251
I have core data app with an entity OBSERVATION that has as one of its attributes DEALNAME. I want to reference through Interface Builder or by making custom modifications to an NSArrayController a list of unique sorted dealnames so that I can use them in a pop-up.
I have attempted to use @distinctUnionOfSets (and @distinctUnionOfArrays) but am unable to locate the proper key sequence.
I can sort the ArrayController by providing a sort descriptor, but do not know how to eliminate duplicates.
Are the @distinct... keys the right methodology? It would seem to provide the easiest way to optimize the use of IB.
Is there a predicate form for removing duplicates?
Or do I need to use my custom controller to extract an NSSet of the specific dealnames, put them back in an array and sort it and reference the custom array from IB?
Any help would be appreciated. I am astounded that other have not tried to create a sorted-unique pop-up in tableviews.
© Stack Overflow or respective owner