I want to create an NSFetchRequest
for objects like this:
The Object
is Car
which has an attribute
color
Did you tried to use valueForKeyPath
? You can do something like that in the array that NSPredicate provide to you.
NSArray* distinctColors = [cars valueForKeyPath:@"@distinctUnionOfObjects.color"];
It will return to you the distinct colors that you have, I do not know if it is what you want, but with the colors you can do something like @Anupdas told: