One Quickie


Filtering an array (NSArray->General)
You can use NSPredicate and -filteredArrayUsingPredicate: to selectively remove stuff from an array.
    NSPredicate *hasZone = [NSPredicate predicateWithBlock:
                                            ^BOOL (id obj, NSDictionary *bindings) {
            GRProfileCueTime *cueTime = obj;
            return cueTime.cue.targetHeartZone != kZoneNone;
        }];
    NSArray *justZones = [cues filteredArrayUsingPredicate: hasZone];
This removes all of the elements of the array that do not have a target heart zone.

If this kind of stuff is useful for you, you might want to check out Mike Ash's collection utilities.



borkware home | products | miniblog | rants | quickies | cocoaheads
Advanced Mac OS X Programming book

webmonster@borkware.com