Inherits from NSObject
Declared in JOEModelManager.h

Overview

Simple data storage manager using NSCoding for persistance to disk.

Tasks

Creating JOEModelManager

  • + sharedManager

    This method allocates and initializes the singleton manager object if one doesn’t already exist.

Insertion and Deletion

Object Retrieval

Model Loading and Saving

  • – load

    Loads the shared object model from disk.

  • – save

    Saves the shared model to disk.

Class Methods

sharedManager

This method allocates and initializes the singleton manager object if one doesn’t already exist.

+ (instancetype)sharedManager

Return Value

The shared manager instance.

Declared In

JOEModelManager.h

Instance Methods

addObject:

Inserts a given object at the end of the shared model.

- (void)addObject:(id)object

Parameters

object

The object to be added to the model.

Declared In

JOEModelManager.h

exchangeObjectAtIndex:withObjectAtIndex:

Exchanges the objects in the shared model at given indices.

- (void)exchangeObjectAtIndex:(NSUInteger)idx1 withObjectAtIndex:(NSUInteger)idx2

Parameters

idx1

The index of the object with which to replace the object at index idx2.

idx2

The index of the object with which to replace the object at index idx1.

Declared In

JOEModelManager.h

insertObject:atIndex:

Inserts a given object into the shared model manager’s contents at a given index. If index is already occupied, the objects at index and beyond are shifted by adding 1 to their indices to make room.

- (void)insertObject:(id)object atIndex:(NSUInteger)index

Parameters

object

The object to be inserted at the given index.

index

The index at which the object will be inserted.

Declared In

JOEModelManager.h

load

Loads the shared object model from disk.

- (BOOL)load

Return Value

If YES, it was a success the model is either already loaded or it was loaded from disk.

Declared In

JOEModelManager.h

objectAtIndex:

Returns an object from the shared model at the given index

- (id)objectAtIndex:(NSUInteger)index

Parameters

index

An index within the bounds of the array.

Return Value

The object located at index.

Declared In

JOEModelManager.h

removeObject:

Removes all occurrences of an object in the shared model.

- (void)removeObject:(id)object

Parameters

object

The object to be removed from the model.

Declared In

JOEModelManager.h

replaceObjectAtIndex:withObject:

Replaces the object at index with anObject.

- (void)replaceObjectAtIndex:(NSUInteger)index withObject:(id)object

Parameters

index

The index of the object which will be replaced.

object

The object that will replace the one at the index. Should not be nil.

Declared In

JOEModelManager.h

save

Saves the shared model to disk.

- (BOOL)save

Return Value

If YES, it was a success and the model was saved.

Declared In

JOEModelManager.h