Declared in NSObject+TKCategory.h
NSObject+TKCategory.m

Overview

Additional functionality for NSObject.

Class Methods

createObject:

Creates object and imports data from an NSDictionary objects using the map provided by the dataKeys dictionary.

+ (id)createObject:(NSDictionary *)dictionary

Parameters

dictionary

The data that will be imported.

Return Value

The newly allocated object.

Declared In

NSObject+TKCategory.h

dataKeys

For subclassing, this method should return the item’s properties mapped to the data dictionary keys. See the DataTests.m for an example implementation.

+ (NSDictionary *)dataKeys

Return Value

The dictionary used to fill up data from the data dictionary.

Discussion

 @{
    @"identifier"       : @"id",
    @"name"             : @"name",
    @"createdAt"        : @[@"created_at",@"yyyy-MM-dd'T'HH:mm:ss"], // For NSDate
    @"updatedAt"        : @[@"updated_at",@"yyyy-MM-dd"],
    @"sub-objects"      : @{ @"class" : @"Product", @"structure" : @"NSArray", @"key" : @"products" }
 };

Declared In

NSObject+TKCategory.h

Instance Methods

importDataWithDictionary:

Imports data from an NSDictionary objects using the map provided by the dataKeys dictionary.

- (void)importDataWithDictionary:(NSDictionary *)dictionary

Parameters

dictionary

The data that will be imported.

Declared In

NSObject+TKCategory.h