I’ve mentioned the Magical Record library that provides an implementation of the Active Record pattern inspired by Ruby On Rails for Core Data objects, and the iActiveRecord library providing an active record implementation for SQLite based databases.
Today I came across another open source library for managing Core Data objects using the active record pattern.
Here’s an example of the syntax taken from the readme:
[[Person all] each:^(Person *person) {
person.member = @NO;
}];
for(Person *person in [Person all]) {
person.member = @YES;
}
// create / save
Person *john = [Person create];
john.name = @"John";
john.surname = @"Wayne";
john.save;
// find / delete
[[Person where: @{ "member" : @NO }] each:^(Person *person) {
[person delete];
}];
The library is Objective-Record from Marin Usalj and can be cloned from Github using:
You can read more about Objective-Record on Marin’s blog here and you can find it on Github here.
Looks like a good choice if you’re looking for something more lightweight than Magical Record for managing Core Data objects.