Commit ff386534 authored by Felix Paul Kühne's avatar Felix Paul Kühne

MLAlbum: add selector to fetch a list of tracks sorted by track number

parent a726c3e3
......@@ -34,6 +34,7 @@
@property (nonatomic, retain) NSString *releaseYear;
@property (nonatomic, retain) NSSet *tracks;
@property (nonatomic, retain, readonly) NSSet *unreadTracks;
@property (nonatomic, readonly) NSArray *sortedTracks;
- (void)removeTrack:(MLAlbumTrack *)track;
- (void)removeTrackWithNumber:(NSNumber *)trackNumber;
......@@ -65,6 +65,17 @@
@dynamic tracks;
@dynamic unreadTracks;
- (NSArray *)sortedTracks
NSArray *tracks = [[self valueForKey:@"tracks"] allObjects];
NSSortDescriptor *trackNumberDescriptor =
[[NSSortDescriptor alloc] initWithKey:@"trackNumber"
return [[tracks sortedArrayUsingDescriptors:@[trackNumberDescriptor]] retain];
- (void)removeTrack:(MLAlbumTrack *)track
if (!track)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment