> You can do this using Key Value Coding, specifically using the collection > operators like @distinctUnionOfSets etc. > > -Steven > > > On Wed, Feb 10, 2010 at 9:11 PM, Jens Alfke <j...@mooseyard.com> wrote: > >> >> On Feb 10, 2010, at 1:45 PM, Trygve Inda wrote: >> >>> iTunes seems to do this with the column browser... Eg when you select >>> "Classic Rock", it pulls up a list of Artists without duplicates in the >>> list... And does it very fast. >> >> But keep in mind that iTunes is a Carbon app, not Cocoa. >> >>> It seems like a Predicate is working here... When one clicks "Classic >> Rock", >>> that is added to the predicate as Genre="Classic Rock", but then how does >> it >>> extract the list of Artists from the master array since it doesn't want >>> duplicates? >> >> You're asking about iTunes' implementation, which we have no idea about. It >> seems to use some kind of custom database. What you're describing is a >> typical sort of database query (in SQL it would be like "select distinct >> artist from ..."). >> >> At a low level, in your code you could use an NSMutableSet to collect >> together the artist results, which would remove duplicates. I'm sure this >> would get awkward to work with, though. >> >> Basically I think you're running into the limitations of your very simple >> data structure. You could come up with something more complex, or you could >> start using CoreData and let it manage the data storage and querying for >> you. >>
Many thanks... It seems @distinctUnionOfSets will work nicely here. Cheers, Trygve _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com