Objective-c – Is there something similar to LINQ in Objective-C


I wonder if it is possible (and how) to provide a class in Objective-C with something like:


That could be very handy for a project I'm doing.

I like this way of coding present in Django & SubSonic.

Best Solution

I created my own Linq-style API for Objective C, which is available on github. Your specific example would look something like this:

NSArray* results = [[[people where:^BOOL(id person) {
                                return [person id] == 1 && [person id] != 2;
                             select:^id(id person) {
                                return [person name];