implementation of an activerecord-like pattern for objective c
pod 'NFRecord', :git => 'https://github.com/NextFaze/NFRecord.git'
The project contains a NFRecord target that compiles to a cocoa touch static library, which can be added in the normal way.
Your model classes should extend NFRecordBase. For example:
@interface Dog : NFRecordBase
@property (nonatomic, strong) NSString *breed;
@property (nonatomic, strong) NSNumber *age;
@property (nonatomic, strong) NSString *color;
@property (nonatomic, strong) NSString *raceName;
@end
to initialize a dog from a dictionary:
NSDictionary *attributes = @{ @"breed:: @"Doge", @"age": @(5), @"color": @"blue", @"race_name": @"Doge" };
Dog *dog = [Dog alloc] initWithDictionary:attributes];
also, assign attributes from a dictionary:
dog.attributes = @{ @"age": @(6) };
Underscored attributes in dictionaries are automatically mapped to camelcase properties.
NFRecord is licensed under the terms of the Apache License, version 2.0. Please see the LICENSE file for full details.