Sorting NSSets of a core data entity - Objective-c
Posted
by ncohen
on Stack Overflow
See other posts from Stack Overflow
or by ncohen
Published on 2010-03-11T17:20:20Z
Indexed on
2010/03/11
17:24 UTC
Read the original article
Hit count: 442
Hi everyone, I would like to sort the data of a core data NSSet (I know we can do it only with arrays but let me explain...). I have an entity user who has a relationship to-many with the entity recipe. A recipe has the attributes name and id. I would like to get the data such that:
Code:
NSArray *id = [[user.recipes valueForKey:@"identity"] allObjects];
NSArray *name = [[user.recipes valueForKey:@"name"] allObjects];
if I take the object at index 1 in both arrays, they correspond to the same recipe...
Thanks
© Stack Overflow or respective owner