Getting unique items from NSMutableArray
Posted
by Gidogeek
on Stack Overflow
See other posts from Stack Overflow
or by Gidogeek
Published on 2010-06-03T20:03:12Z
Indexed on
2010/06/03
20:04 UTC
Read the original article
Hit count: 206
Hi Guys,
I have a question about Objective-C today involving NSMutableArray. Coming from a .net/c# background I'm having some trouble working with these things.
Let's say I have an object called "Song"
My song has 3 properties:
- Title
- Artist
- Genre
I have a NSMutableArray or NSArray wich holds all my Song objects.
How would I go about trying to 'query' my array to get a new array with only (Unique) Artists or Genre's.
Where as in .net you would write a simple LINQ query with a DISTINCT clause, how would one solve this in Objective-C ? I'm guessing with predicates but am struggling to find a solution.
Thanks in advance.
© Stack Overflow or respective owner