Declared in NSManagedObject+CYCoreData.h
NSManagedObject+CYCoreData.m

Class Methods

configureModelUniqueIdentifier:ofDataType:withJSONSearchString:

Sets the keys for and type of unique indexer for NSManagedObjects. This key is used to fetch unique NSEntity in the database.

+ (void)configureModelUniqueIdentifier:(NSString *)uniquePropertyKey ofDataType:(UniqueObjectValueType)uniqueObjectValueType withJSONSearchString:(NSString *)jsonSearchPropertyKey

Parameters

uniquePropertyKey

NSStringfor the unique property key if the NSManagedObject; example @“uid”

uniqueObjectValueType

UniqueObjectValueType type of value the uniquePropertyKey is

jsonSearchPropertyKey

NSStringthe key the unique property will have on a JSON of for that object

Discussion

Warning: If called, must call before [CYCoreData liason].

Declared In

NSManagedObject+CYCoreData.h

configureUniqueIdentifier:

+ (void)configureUniqueIdentifier:(UniqueIdentiferStruct)uniqueIdentiferStruct

Parameters

`UniqueIdentiferStruct`

Predefined struct of the values passesd to configureModelUniqueIdentifier:ofDataType:withJSONSearchString:

Discussion

Warning: If called, must call before [CYCoreData liason].

Declared In

NSManagedObject+CYCoreData.h

deleteAllObjectsInContext:

Deletes all NSEntityDescription of NSManagedObject subclass that calls it from the NSManagedObjectContext passed.

+ (void)deleteAllObjectsInContext:(NSManagedObjectContext *)context

Parameters

context

NSManagedObjectContextto delete the NSManagedObject subclass from

Declared In

NSManagedObject+CYCoreData.h

deleteObjectsInContext:sortedBy:withPredicate:

Deletes specifically fetched NSEntityDescription of NSManagedObject with NSSortDescriptors and NSPredicate of subclass that calls it from the NSManagedObjectContext passed.

+ (void)deleteObjectsInContext:(NSManagedObjectContext *)context sortedBy:(NSArray *)sortDescriptors withPredicate:(NSPredicate *)predicate

Parameters

context

NSManagedObjectContextto delete the NSManagedObject subclass from

sortDescriptors

NSArray of NSSortDescriptors to order against

predicate

NSPredicate to search against

Declared In

NSManagedObject+CYCoreData.h

entityName

Returns a NSString value of to identitify the class of the NSManagedObject

+ (NSString *)entityName

Return Value

NSStringto identify class name

Declared In

NSManagedObject+CYCoreData.h

fetchAllInContext:

Returns all NSManagedObjects of subclass that call it from the NSManagedObjectContext passed.

+ (NSArray *)fetchAllInContext:(NSManagedObjectContext *)context

Parameters

context

NSManagedObjectContext the context to fetch from

Return Value

NSArray of NSManagedObject subclasses from the NSManagedObjectContext passed.

Declared In

NSManagedObject+CYCoreData.h

fetchCountInContext:withPredicate:

Returns an NSUInteger identitifying the number of NSManagedObject subclasses in the NSManagedObjectContext passed with NSPredicate.

+ (NSUInteger)fetchCountInContext:(NSManagedObjectContext *)context withPredicate:(NSPredicate *)predicate

Parameters

context

NSManagedObjectContext to fetch from

predicate

NSPredicate to search against

Return Value

NSUInteger identitifying the number of NSManagedObject subclasses in the NSManagedObjectContext passed with NSPredicate

Declared In

NSManagedObject+CYCoreData.h

fetchFirstObjectInContext:sortedBy:withPredicate:

Returns first NSManagedObject subclasses with NSSortDescriptors and NSPredicate of subclass that calls it from the NSManagedObjectContext passed.

+ (instancetype)fetchFirstObjectInContext:(NSManagedObjectContext *)context sortedBy:(NSArray *)sortDescriptors withPredicate:(NSPredicate *)predicate

Parameters

context

NSManagedObjectContext to fetch from

sortDescriptors

NSArray of NSSortDescriptors to order against

predicate

NSPredicate to search against

Return Value

instancetype NSManagedObject subclass returned from an NSFetchRequest with NSSortDescriptors and NSPredicate from the NSManagedObjectContext passed

Declared In

NSManagedObject+CYCoreData.h

fetchObjectsInContext:byPageNumber:withObjectsPerPage:andPredicate:withSortDescriptors:

Fetches NSEntityDescription of NSManagedObject subclasses with NSSortDescriptors and NSPredicate of subclass that calls it from the NSManagedObjectContext passed. The resulting array is paginated by the perPage and the give page pageNumber is returned

+ (NSArray *)fetchObjectsInContext:(NSManagedObjectContext *)context byPageNumber:(NSInteger)pageNumber withObjectsPerPage:(NSInteger)perPage andPredicate:(NSPredicate *)predicate withSortDescriptors:(NSArray *)sortDescriptors

Parameters

context

NSManagedObjectContext to fetch from

pageNumber

NSInteger the page number to return

perPage

NSInteger the amount of NSManagedObject subclasses per page

predicate

NSPredicate to search against

sortDescriptors

NSArray of NSSortDescriptors to order against

Return Value

NSArray of NSManagedObject subclasses from the NSManagedObjectContext passed, queried by NSSortDescriptors and NSPredicate of pageNumber when paginated by perPage

Declared In

NSManagedObject+CYCoreData.h

fetchObjectsInContext:byPageNumber:withObjectsPerPage:withSortDescriptors:

Fetches NSEntityDescription of NSManagedObject subclasses with NSSortDescriptors of subclass that calls it from the NSManagedObjectContext passed. The resulting array is paginated by the perPage and the give page pageNumber is returned

+ (NSArray *)fetchObjectsInContext:(NSManagedObjectContext *)context byPageNumber:(NSInteger)pageNumber withObjectsPerPage:(NSInteger)perPage withSortDescriptors:(NSArray *)sortDescriptors

Parameters

context

NSManagedObjectContext to fetch from

pageNumber

NSInteger the page number to return

perPage

NSInteger the amount of NSManagedObject subclasses per page

sortDescriptors

NSArray of NSSortDescriptors to order against

Return Value

NSArray of NSManagedObject subclasses from the NSManagedObjectContext passed, queried by sortDescriptors of pageNumber when paginated by perPage

Declared In

NSManagedObject+CYCoreData.h

fetchObjectsInContext:sortedBy:withPredicate:

Returns specifically fetched NSEntityDescriptions of NSManagedObject with sortDescriptors and NSPredicate of subclass that calls it from the NSManagedObjectContext passed.

+ (NSArray *)fetchObjectsInContext:(NSManagedObjectContext *)context sortedBy:(NSArray *)sortDescriptors withPredicate:(NSPredicate *)predicate

Parameters

context

NSManagedObjectContext to fetch the NSManagedObject subclass from

sortDescriptors

NSArray of NSSortDescriptors to order against

predicate

NSPredicate to search against

Return Value

NSArray of NSManagedObject subclasses that satisfy the NSSortDescriptors and NSPredicate

Declared In

NSManagedObject+CYCoreData.h

newObjectInContext:

Creates and returns an NSManagedObject from the subclass that calls via the NSManagedObjectContext passed.

+ (instancetype)newObjectInContext:(NSManagedObjectContext *)context

Parameters

context

NSManagedObjectContextthe context the NSManagedObject subclass will be inserted from

Return Value

instancetype NSManagedObject subclass from the subclass that calls it.

Declared In

NSManagedObject+CYCoreData.h

updateOrCreateObjectInContext:withDictionary:

Creates and returns an NSManagedObject from the subclass that calls via the NSManagedObjectContext passed. The NSDictionary passed will be parsed and key value mapped to the new created NSManagedObject subclass.

+ (instancetype)updateOrCreateObjectInContext:(NSManagedObjectContext *)context withDictionary:(NSDictionary *)dictionary

Parameters

context

NSManagedObjectContext the context the NSManagedObject subclass will be inserted from

dictionary

NSDictionary that will be parsed and key value mapped to the new created NSManagedObject subclass

Return Value

instancetype NSManagedObject subclass from the subclass that calls it.

Declared In

NSManagedObject+CYCoreData.h

Instance Methods

setBoolValuesInDictionary:forKeys:

The NSDictionary will be searched by NSString keys in NSArray. If found, BOOL values will be applied to NSManagedObject subclass that called it.

- (void)setBoolValuesInDictionary:(NSDictionary *)dictionary forKeys:(NSString *)first, ...

Parameters

dictionary

NSDictionary that will be parsed and key value mapped to the new created NSManagedObject subclass

keys

NSArray of NSString keys for BOOLs in the the NSDictionary

Discussion

Warning: Insert keys as iOS paradigm camelCase. Method automatically changes iOS paradigm camelCase to JSON paradigm to under_score key

Declared In

NSManagedObject+CYCoreData.h

setDateValuesInDictionary:forKeys:

The NSDictionary will be searched by NSString keys in NSArray. If found, timestamp string values will be applied to NSManagedObject subclass that called it.

- (void)setDateValuesInDictionary:(NSDictionary *)dictionary forKeys:(NSString *)first, ...

Parameters

dictionary

NSDictionary that will be parsed and key value mapped to the new created NSManagedObject subclass

keys

NSArray of NSString keys for Timestamps in the the NSDictionary

Discussion

Warning: Insert keys as iOS paradigm camelCase. Method automatically changes iOS paradigm camelCase to JSON paradigm to under_score key

Declared In

NSManagedObject+CYCoreData.h

setDoubleValuesInDictionary:forKeys:

The NSDictionary will be searched by NSString keys in NSArray. If found, double values will be applied to NSManagedObject subclass that called it.

- (void)setDoubleValuesInDictionary:(NSDictionary *)dictionary forKeys:(NSString *)first, ...

Parameters

dictionary

NSDictionary that will be parsed and key value mapped to the new created NSManagedObject subclass

keys

NSArray of NSString keys for doubles in the the NSDictionary

Discussion

Warning: Insert keys as iOS paradigm camelCase. Method automatically changes iOS paradigm camelCase to JSON paradigm to under_score key

Declared In

NSManagedObject+CYCoreData.h

setFloatValuesInDictionary:forKeys:

The NSDictionary will be searched by NSString keys in NSArray. If found, float values will be applied to NSManagedObject subclass that called it.

- (void)setFloatValuesInDictionary:(NSDictionary *)dictionary forKeys:(NSString *)first, ...

Parameters

dictionary

NSDictionary that will be parsed and key value mapped to the new created NSManagedObject subclass

keys

NSArray of NSString keys for floats in the the NSDictionary

Discussion

Warning: Insert keys as iOS paradigm camelCase. Method automatically changes iOS paradigm camelCase to JSON paradigm to under_score key

Declared In

NSManagedObject+CYCoreData.h

setIntValuesInDictionary:forKeys:

The NSDictionary will be searched by NSString keys in NSArray. If found, int values will be applied to NSManagedObject subclass that called it.

- (void)setIntValuesInDictionary:(NSDictionary *)dictionary forKeys:(NSString *)first, ...

Parameters

dictionary

NSDictionary that will be parsed and key value mapped to the new created NSManagedObject subclass

keys

NSArray of NSString keys for ints in the the NSDictionary

Discussion

Warning: Insert keys as iOS paradigm camelCase. Method automatically changes iOS paradigm camelCase to JSON paradigm to under_score key

Declared In

NSManagedObject+CYCoreData.h

setIntegerValuesInDictionary:forKeys:

The NSDictionary will be searched by NSString keys in NSArray. If found, NSInteger values will be applied to NSManagedObject subclass that called it.

- (void)setIntegerValuesInDictionary:(NSDictionary *)dictionary forKeys:(NSString *)first, ...

Parameters

dictionary

NSDictionary that will be parsed and key value mapped to the new created NSManagedObject subclass

keys

NSArray of NSString keys for NSIntegers in the the NSDictionary

Discussion

Warning: Insert keys as iOS paradigm camelCase. Method automatically changes iOS paradigm camelCase to JSON paradigm to under_score key

Declared In

NSManagedObject+CYCoreData.h

setKeyValue:fromKey:inDictionary:forManagedObjectValueType:

dictionary will be searched for keyValue of object value type. If found, the property will be saved.

- (void)setKeyValue:(NSString *)keyValue fromKey:(NSString *)key inDictionary:(NSDictionary *)dictionary forManagedObjectValueType:(UniqueObjectValueType)type

Parameters

keyValue

NSString value of the NSManagedObject self

key

NSString value to search the dictionary for

dictionary

NSDictionary to search

type

UniqueObjectValueType object value type of the NSManagedObject property

Declared In

NSManagedObject+CYCoreData.h

setMicrosecondDateValuesInDictionary:forKeys:

The NSDictionary will be searched by NSString keys in NSArray. If found, doubleValue string values will be applied to NSManagedObject subclass that called it.

- (void)setMicrosecondDateValuesInDictionary:(NSDictionary *)dictionary forKeys:(NSString *)first, ...

Parameters

dictionary

NSDictionary that will be parsed and key value mapped to the new created NSManagedObject subclass

keys

NSArray of NSString keys for Timestamps in microseconds in the the NSDictionary

Discussion

Warning: Insert keys as iOS paradigm camelCase. Method automatically changes iOS paradigm camelCase to JSON paradigm to under_score key

Declared In

NSManagedObject+CYCoreData.h

setStringValuesInDictionary:forKeys:

The NSDictionary will be searched by NSString keys in NSArray. If found, NSString values will be applied to NSManagedObject subclass that called it.

- (void)setStringValuesInDictionary:(NSDictionary *)dictionary forKeys:(NSString *)first, ...

Parameters

dictionary

NSDictionary that will be parsed and key value mapped to the new created NSManagedObject subclass

keys

NSArray of NSString keys for NSStrings in the the NSDictionary

Discussion

Warning: Insert keys as iOS paradigm camelCase. Method automatically changes iOS paradigm camelCase to JSON paradigm to under_score key

Declared In

NSManagedObject+CYCoreData.h

setUnixDateValuesInDictionary:forKeys:

The NSDictionary will be searched by NSString keys in NSArray. If found, int string values will be applied to NSManagedObject subclass that called it.

- (void)setUnixDateValuesInDictionary:(NSDictionary *)dictionary forKeys:(NSString *)first, ...

Parameters

dictionary

NSDictionary that will be parsed and key value mapped to the new created NSManagedObject subclass

keys

NSArray of NSString keys for Unix Timestamps in the the NSDictionary

Discussion

Warning: Insert keys as iOS paradigm camelCase. Method automatically changes iOS paradigm camelCase to JSON paradigm to under_score key

Declared In

NSManagedObject+CYCoreData.h

updateWithDictionary:

The NSDictionary passed will be parsed and key value mapped to NSManagedObject the subclass.

- (void)updateWithDictionary:(NSDictionary *)dictionary

Parameters

dictionary

NSDictionary that will be parsed and key value mapped to the new created NSManagedObject subclass

Declared In

NSManagedObject+CYCoreData.h