SCCoreDataStore

@interface SCCoreDataStore : SCDataStore

SCCoreDataStore is an SCDataStore subclass that encapsulates Core Data persistent storage, providing means for the SC framework to communicate with this storage to fetch, add, update and remove data objects.

Note

It is very rare when you’ll need to create an SCCoreDataStore instance yourself, as it’s typically automatically created for you when you use the SCEntityDefinition data definition. For example, when you use the SCArrayOfObjectsSection initializer method called [SCArrayOfObjectsSection sectionWithHeaderTitle:entityDefinition:], SCArrayOfObjectsSection automatically sets its dataStore property by calling your entityDefinition’s [SCDataDefinition generateCompatibleDataStore:] method.

Note

For more information on data stores, check out the SCDataStore base class documentation.

Creation and Initialization

  • Allocates and returns an initialized SCCoreDataStore given a managed object context and an entity definition.

    Declaration

    Objective-C

    + (instancetype)storeWithManagedObjectContext:(NSManagedObjectContext *)context
                          defaultEntityDefinition:(SCEntityDefinition *)definition;

    Parameters

    context

    The Core Data managed object context.

    definition

    The entity definition of the entity objects in the data store.

  • Allocates and returns an initialized SCCoreDataStore given a managed object context and an NSMutableSet to bind the data store to.

    Declaration

    Objective-C

    + (instancetype)storeWithManagedObjectContext:(NSManagedObjectContext *)context
                                         boundSet:(NSMutableSet *)set
                         boundSetEntityDefinition:(SCEntityDefinition *)definition
                         boundSetOwnsStoreObjects:(BOOL)ownsStoreObjects;

    Parameters

    context

    The Core Data managed object context.

    set

    An NSMutableSet that the data store will bind to and fetch all its objects from.

    definition

    The entity definition of the entity objects in the bound set.

    ownsStoreObjects

    When TRUE, objects removed from the bound set will also be removed from the data store.

  • Returns an initialized SCCoreDataStore given a managed object context and an entity definition.

    Declaration

    Objective-C

    - (instancetype)initWithManagedObjectContext:(NSManagedObjectContext *)context
                         defaultEntityDefinition:(SCEntityDefinition *)definition;

    Parameters

    context

    The Core Data managed object context.

    definition

    The entity definition of the entity objects in the data store.

  • Returns an initialized SCCoreDataStore given a managed object context and an NSMutableSet to bind the data store to.

    Declaration

    Objective-C

    - (instancetype)initWithManagedObjectContext:(NSManagedObjectContext *)context
                                        boundSet:(NSMutableSet *)set
                        boundSetEntityDefinition:(SCEntityDefinition *)definition
                        boundSetOwnsStoreObjects:(BOOL)ownsStoreObjects;

    Parameters

    context

    The Core Data managed object context.

    set

    An NSMutableSet that the data store will bind to and fetch all its objects from.

    definition

    The entity definition of the entity objects in the bound set.

    ownsStoreObjects

    When TRUE, objects removed from the bound set will also be removed from the data store.

Configuration

  • The managed object context associated with the store.

    Declaration

    Objective-C

    @property (nonatomic, strong) NSManagedObjectContext *managedObjectContext;
  • The NSMutableSet the store is bound to. This property is automatically set by bindStoreToPropertyName:forObject:withDefinition: method.

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) NSMutableSet *boundSet;
  • The NSMutableOrderedSet the store is bound to. This property is automatically set by bindStoreToPropertyName:forObject:withDefinition: method.

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) NSMutableOrderedSet *boundOrderedSet;
  • When TRUE, objects removed from boundSet will also be removed from the data store.

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL boundSetOwnsStoreObjects;