Skip to content
Linq to Objective-C objects
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

LinqKit is a proposal for implementing the functionality known as Linq (Language Integrated Query) in .NET, but then for Objective-C.

Currently it is implemented as Categories on NSObject. It works with deferred execution by using custom NSEnumerator subclasses.

For the moment basic implementations of where, select, skip and take have been implemented. Any additions or suggestions are welcomed.

The syntax that I defined looks like this:

NSArray *arr = [[NSArray alloc]initWithObjects:@"one", 
  @"two", @"three", @"four", @"five", @"six", @"seven", @"eight", @"nine", 
  @"ten", @"eleven", @"twelve", @"thirteen", @"fourteen", @"fifteen",
  @"sixteen", @"seventeen", @"eighteen", @"nineteen", @"twenty", nil];

for(id string in [[[[arr where:^BOOL(id t){ return ![t hasPrefix:@"e"]; }] 
    select:^id(id r) { return [NSString stringWithFormat:@"result : %@", r]; } ])
  NSLog(@"%@", string);

Kind regard, Jeroen

Something went wrong with that request. Please try again.