[Solved] Objective-C Fast Enumeration: checking for BOOL


NSPredicate *predicate = [NSPredicate predicateWithFormat:@"wasRead = YES"];
NSArray *arr = [array filteredArrayUsingPredicate:predicate];

Can sort a thousand objects in 0.0004 seconds.

Then just do:

for (NSDictionary *object in arr) {
    //Statements
}

Edit: actually after further experimentation, using fast-enumeration is about four times faster, about 0.0001, which if scaled to 100000 objects can be much, much faster.

NSMutableArray *test = [NSMutableArray array];

for (NSDictionary *dict in array)
    if ([dict[@"theKey"] boolValue])
        [test addObject:dict];

So for sorting, fast-enumeration is actually faster but for just a couple hundred objects, the performance increase is negligible.

And please before asking questions like this and getting downvotes, those could have been completely avoided by checking the documentation. Like this article and this article.

solved Objective-C Fast Enumeration: checking for BOOL