Best implementation for iTunes-like playlist structure?
Best implementation for iTunes-like playlist structure?
- Subject: Best implementation for iTunes-like playlist structure?
- From: Dave DeLong <email@hidden>
- Date: Sat, 07 Nov 2009 19:32:38 -0700
Hi everyone,
I'm creating an app that has a master-detail interface, similar to
iTunes. It has the same data hierarchy as iTunes' playlists (except
that I'm not allowing groups of "playlists" to keep things simple).
In other words, there are normal playlists where their only items are
added manually by the user. There are smart playlists, which show all
items that match a user-defined predicate. Finally, there are some
"playlists" that are not editable at all by the user (I call these
"DefaultFolders"), but are in essence nothing more than fancy smart
playlists in that their predicate is to show everything. These are
like the "Library" and "Movies" sections in iTunes.
In my attempt to recreate this structure, I've come up with the
following hierarchy (in Core Data): http://gallery.me.com/davedelong#100084/Screen shot 2009-11-07 at 7.17.53 PM&bgcolor=black
(hopefully it is self-explanatory)
However, as I've gotten further into this app, this structure has
become a little cumbersome. For example, I defined an accessor on the
AbstractFolder class called - (NSSet *)items, so that all concrete
folder types (DefaultFolder, SmartFolder, and Folder) can easily
retrieve their contents. This coincides with relationship that the
Folder entity has with the Item entity. However, I can't implement
the items accessor in AbstractFolder, because that would override the
generated accessor provided by Core Data for the Folder Entity. I've
thought about making it part of a protocol that all concrete folders
would implement, but that seems to defeat the purpose of inheritance.
So I open this up to the collective wisdom of the mailing list. Is
there a better way I could model this structure? Have any of you
worked on apps with similar structures? What did you find helpful?
Any insights or suggestions you could sure are greatly appreciated.
Thanks!
Dave DeLong
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden