Categories
iOS Development Libraries Objective-C Open Source iOS Libraries And Tools

Open Source iOS Library Providing And Extensive Functional Toolbelt For Data Structures

Previously I mentioned the Ruby inspired Objective-Sugar and the Underscore.js inspired Underscore.m.

Here’s an extensive functional toolbelt for objective-c for manipulating Foundation’s data structures from Underscore.m founder Robert Böhnke (Robb) called Asterism that takes a different approach from the previously mentioned libraries as it does not use a Ruby inspired syntax or categories.

As Robb stated in his e-mail:

It uses overloaded C-functions instead of categories (like BlocksKit and Objective-Sugar do). This allowed me to unify the interface for all kinds of different data-structures (NSArray, NSDictionary, NSSet, NSOrderedSet and occasionally even id< nsfastnumeration >)

Here’s an example from the readme showing the Asterism ASTEach command for iterating through an array:

ASTEach(@[ @"a", @"b", @"c" ], ^(NSString *letter) {
    NSLog(@"%@", letter);
});

ASTEach(@[ @"a", @"b", @"c" ], ^(NSString *letter, NSUInteger index) {
    NSLog(@"%u: %@", index, letter);
});

ASTEach(@{ @"foo": @"bar" }, ^(NSString *key, NSString *value) {
    NSLog(@"%@: %@", key, value);
});

You can find Asterism on the home page here.

A very nice library for working with data structures wihth a very clean syntax.