Declared in NSObject+TKCategory.h

Overview

Additional functionality for NSObject.

Tasks

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.

Discussion

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

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

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

 @{
    @"identifier" : @"id",
    @"name" : @"name",
    @"createdAt" : @[@"created_at",@"yyyy-MM-dd'T'HH:mm:ss"], // For NSDate
    @"updatedAt" : @[@"updated_at",@"yyyy-MM-dd"]
 };

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.

Discussion

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

Declared In

NSObject+TKCategory.h

processJSON:options:withCompletion:

Process JSON data in the background with a completion block.

- (void)processJSON:(NSData *)data options:(NSJSONReadingOptions)options withCompletion:(TKJSONCompletionBlock)block

Parameters

data

The JSON data.

options

An json parsing options to be included will parsing the JSON data.

block

The block that will be performed upon the parsing of the json data. The process data will be included as an object with the selector.

Discussion

Process JSON data in the background with a completion block.

Declared In

NSObject+TKCategory.h

processJSON:withCompletion:

Process JSON data in the background with a completion block.

- (void)processJSON:(NSData *)data withCompletion:(TKJSONCompletionBlock)block

Parameters

data

The JSON data.

block

The block that will be performed upon the parsing of the json data. The process data will be included as an object with the selector.

Discussion

Process JSON data in the background with a completion block.

Declared In

NSObject+TKCategory.h

processJSONDataInBackground:withCallbackSelector:

Process JSON data in the background with a callback selector.

- (void)processJSONDataInBackground:(NSData *)data withCallbackSelector:(SEL)callback

Parameters

data

The JSON data.

callback

The selector that will be performed upon the parsing of the json data. The process data will be included as an object with the selector.

Discussion

Process JSON data in the background with a callback selector.

Declared In

NSObject+TKCategory.h

processJSONDataInBackground:withCallbackSelector:backgroundSelector:errorSelector:

Process JSON data in the background with a callback selector.

- (void)processJSONDataInBackground:(NSData *)data withCallbackSelector:(SEL)callback backgroundSelector:(SEL)backgroundProcessor errorSelector:(SEL)errroSelector

Parameters

data

The JSON data.

callback

The selector that will be performed upon the parsing of the json data. The process data will be included as an object with the selector.

backgroundProcessor

The selector that will be performed in the background upon the parsing of the json data. The process data will be included as an object with the selector. This selector must return some type of object to be passed to the callback selector.

errroSelector

The selector that will be called upon if there is an error parsing the data.

Discussion

Process JSON data in the background with a callback selector.

Declared In

NSObject+TKCategory.h

processJSONDataInBackground:withCallbackSelector:backgroundSelector:errorSelector:readingOptions:

Process JSON data in the background with a callback selector.

- (void)processJSONDataInBackground:(NSData *)data withCallbackSelector:(SEL)callback backgroundSelector:(SEL)backgroundProcessor errorSelector:(SEL)errroSelector readingOptions:(NSJSONReadingOptions)options

Parameters

data

The JSON data.

callback

The selector that will be performed upon the parsing of the json data. The process data will be included as an object with the selector.

backgroundProcessor

The selector that will be performed in the background upon the parsing of the json data. The process data will be included as an object with the selector. This selector must return some type of object to be passed to the callback selector.

errroSelector

The selector that will be called upon if there is an error parsing the data.

options

An json parsing options to be included will parsing the JSON data.

Discussion

Process JSON data in the background with a callback selector.

Declared In

NSObject+TKCategory.h

processJSONDataInBackground:withCallbackSelector:backgroundSelector:readingOptions:

Process JSON data in the background with a callback selector.

- (void)processJSONDataInBackground:(NSData *)data withCallbackSelector:(SEL)callback backgroundSelector:(SEL)backgroundProcessor readingOptions:(NSJSONReadingOptions)options

Parameters

data

The JSON data.

callback

The selector that will be performed upon the parsing of the json data. The process data will be included as an object with the selector.

backgroundProcessor

The selector that will be performed in the background upon the parsing of the json data. The process data will be included as an object with the selector. This selector must return some type of object to be passed to the callback selector.

options

An json parsing options to be included will parsing the JSON data.

Discussion

Process JSON data in the background with a callback selector.

Declared In

NSObject+TKCategory.h

processJSONDataInBackground:withCallbackSelector:readingOptions:

Process JSON data in the background with a callback selector.

- (void)processJSONDataInBackground:(NSData *)data withCallbackSelector:(SEL)callback readingOptions:(NSJSONReadingOptions)options

Parameters

data

The JSON data.

callback

The selector that will be performed upon the parsing of the json data. The process data will be included as an object with the selector.

options

An json parsing options to be included will parsing the JSON data.

Discussion

Process JSON data in the background with a callback selector.

Declared In

NSObject+TKCategory.h