Classes
The following classes are available globally.
-
The
See moreAsynchronousDataTransactionprovides an interface forDynamicObjectcreates, updates, and deletes. A transaction object should typically be only used from within a transaction block initiated fromDataStack.perform(asynchronous:...), or fromCoreStore.perform(synchronous:...).Declaration
Swift
public final class AsynchronousDataTransaction : BaseDataTransaction
-
The
See moreBaseDataTransactionis an abstract interface forNSManagedObjectcreates, updates, and deletes. AllBaseDataTransactionsubclasses manage a privateNSManagedObjectContextwhich are direct children of theNSPersistentStoreCoordinator‘s rootNSManagedObjectContext. This means that all updates are saved first to the persistent store, and then propagated up to the read-onlyNSManagedObjectContext.Declaration
Swift
public class BaseDataTransaction
-
The
CSAsynchronousDataTransactionserves as the Objective-C bridging type forAsynchronousDataTransaction.See moreSee also
AsynchronousDataTransactionDeclaration
Swift
@objc public final class CSAsynchronousDataTransaction : CSBaseDataTransaction, CoreStoreObjectiveCType
-
The
CSBaseDataTransactionserves as the Objective-C bridging type forBaseDataTransaction.See moreSee also
BaseDataTransactionDeclaration
Swift
@objc public class CSBaseDataTransaction : NSObject
-
Declaration
Swift
@objc public final class CSDataStack : NSObject, CoreStoreObjectiveCType
-
The
See moreDataStackencapsulates the data model for the Core Data stack. EachDataStackcan have multiple data stores, usually specified as aConfiguration
in the model editor. Behind the scenes, the DataStack manages its ownNSPersistentStoreCoordinator, a rootNSManagedObjectContextfor disk saves, and a sharedNSManagedObjectContextdesigned as a read-only model interface forNSManagedObjects.Declaration
Swift
public final class DataStack : Equatable
-
Declaration
Swift
@objc public final class CSError : NSError, CoreStoreObjectiveCType
-
Declaration
Swift
@objc public final class CSGroupBy : NSObject, CSQueryClause
-
The
CSInMemoryStoreserves as the Objective-C bridging type forInMemoryStore.See moreSee also
InMemoryStoreDeclaration
Swift
@objc public final class CSInMemoryStore : NSObject, CSStorageInterface, CoreStoreObjectiveCType
-
A storage interface that is backed only in memory.
See moreDeclaration
Swift
public final class InMemoryStore : StorageInterface
-
The
CSListMonitorserves as the Objective-C bridging type forListMonitor<T>.See moreSee also
ListMonitorDeclaration
Swift
@available(OSX 10.12, *) @objc public final class CSListMonitor : NSObject
-
The
CSMigrationResultserves as the Objective-C bridging type forMigrationResult.See moreSee also
MigrationResultDeclaration
Swift
@objc public final class CSMigrationResult : NSObject, CoreStoreObjectiveCType
-
The
CSMigrationTypeserves as the Objective-C bridging type forMigrationType.See moreSee also
MigrationTypeDeclaration
Swift
@objc public final class CSMigrationType : NSObject, CoreStoreObjectiveCType
-
The
CSObjectMonitorserves as the Objective-C bridging type forObjectMonitor<T>.See moreSee also
ObjectMonitorDeclaration
Swift
@available(OSX 10.12, *) @objc public final class CSObjectMonitor : NSObject
-
Declaration
Swift
@objc public final class CSOrderBy : NSObject, CSFetchClause, CSQueryClause, CSDeleteClause
-
The
CSSQLiteStoreserves as the Objective-C bridging type forSQLiteStore.See moreSee also
SQLiteStoreDeclaration
Swift
@objc public final class CSSQLiteStore : NSObject, CSLocalStorage, CoreStoreObjectiveCType
-
A storage interface that is backed by an SQLite database.
See moreWarning
The default SQLite file location for theLegacySQLiteStoreandSQLiteStoreare different. If the app was depending on CoreStore’s default directories prior to 2.0.0, make sure to use theSQLiteStore.legacy(...)factory methods to create theSQLiteStoreinstead of using initializers directly.Declaration
Swift
public final class SQLiteStore : LocalStorage
-
The
CSSelectTermserves as the Objective-C bridging type forSelectTerm.See moreSee also
SelectTermDeclaration
Swift
@objc public final class CSSelectTerm : NSObject
-
The
CSSetupResultserves as the Objective-C bridging type forSetupResult.See moreSee also
SetupResultDeclaration
Swift
@objc public final class CSSetupResult : NSObject
-
The
CSSynchronousDataTransactionserves as the Objective-C bridging type forSynchronousDataTransaction.See moreSee also
SynchronousDataTransactionDeclaration
Swift
@objc public final class CSSynchronousDataTransaction : CSBaseDataTransaction, CoreStoreObjectiveCType
-
The
See moreSynchronousDataTransactionprovides an interface forDynamicObjectcreates, updates, and deletes. A transaction object should typically be only used from within a transaction block initiated fromDataStack.beginSynchronous(_:), or fromCoreStore.beginSynchronous(_:).Declaration
Swift
public final class SynchronousDataTransaction : BaseDataTransaction
-
Declaration
Swift
@objc public final class CSTweak : NSObject, CSFetchClause, CSQueryClause, CSDeleteClause, CoreStoreObjectiveCType
-
The
CSUnsafeDataModelSchemaserves as the Objective-C bridging type forUnsafeDataModelSchema.See moreSee also
UnsafeDataModelSchemaDeclaration
Swift
@objc public final class CSUnsafeDataModelSchema : NSObject, CSDynamicSchema, CoreStoreObjectiveCType
-
The
See moreUnsafeDataModelSchemadescribes models loaded directly from an existingNSManagedObjectModel. It is not advisable to continue using this model as its metadata are not available to CoreStore.Declaration
Swift
public final class UnsafeDataModelSchema : DynamicSchema
-
The
CSUnsafeDataTransactionserves as the Objective-C bridging type forUnsafeDataTransaction.See moreSee also
UnsafeDataTransactionDeclaration
Swift
@objc public final class CSUnsafeDataTransaction : CSBaseDataTransaction, CoreStoreObjectiveCType
-
The
See moreUnsafeDataTransactionprovides an interface for non-contiguousNSManagedObjectorCoreStoreObjectcreates, updates, and deletes. This is useful for making temporary changes, such as partially filled forms. An unsafe transaction object should typically be only used from the main queue.Declaration
Swift
public final class UnsafeDataTransaction : BaseDataTransaction
-
Declaration
Swift
@objc public final class CSWhere : NSObject, CSFetchClause, CSQueryClause, CSDeleteClause
-
The
CSXcodeDataModelSchemaserves as the Objective-C bridging type forXcodeDataModelSchema.See moreSee also
XcodeDataModelSchemaDeclaration
Swift
@objc public final class CSXcodeDataModelSchema : NSObject, CSDynamicSchema, CoreStoreObjectiveCType
-
The
XcodeDataModelSchemadescribes a model version declared in a single *.xcdatamodeld file.
See moreCoreStore.defaultStack = DataStack( XcodeDataModelSchema(modelName: "MyAppV1", bundle: .main) )Declaration
Swift
public final class XcodeDataModelSchema : DynamicSchema
-
The
CoreStoreObjectis an abstract class for creating CoreStore-managed objects that are more type-safe and more convenient thanNSManagedObjectsubclasses. The model entities forCoreStoreObjectsubclasses are inferred from the Swift declaration themselves; no .xcdatamodeld files are needed. To declare persisted attributes and relationships for theCoreStoreObjectsubclass, declare properties of typeValue.Required<T>,Value.Optional<T>for values, orRelationship.ToOne<T>,Relationship.ToManyOrdered<T>,Relationship.ToManyUnordered<T>for relationships.class Animal: CoreStoreObject { let species = Value.Required<String>("species", initial: "") let nickname = Value.Optional<String>("nickname") let master = Relationship.ToOne<Person>("master") } class Person: CoreStoreObject { let name = Value.Required<String>("name", initial: "") let pet = Relationship.ToOne<Animal>("pet", inverse: { $0.master }) }CoreStoreObjectentities for a model version should be added toCoreStoreSchemainstance.CoreStore.defaultStack = DataStack( CoreStoreSchema( modelVersion: "V1", entities: [ Entity<Animal>("Animal"), Entity<Person>("Person") ] ) )See also
CoreStoreSchemaSee also
CoreStoreObject.ValueSee moreSee also
CoreStoreObject.RelationshipDeclaration
Swift
open class CoreStoreObject : DynamicObject, Hashable
-
The
CoreStoreSchemadescribes models written forCoreStoreObjectSwift class declarations for a particular model version.CoreStoreObjectentities for a model version should be added toCoreStoreSchemainstance.class Animal: CoreStoreObject { let species = Value.Required<String>("species", initial: "") let nickname = Value.Optional<String>("nickname") let master = Relationship.ToOne<Person>("master") } class Person: CoreStoreObject { let name = Value.Required<String>("name", initial: "") let pet = Relationship.ToOne<Animal>("pet", inverse: { $0.master }) } CoreStore.defaultStack = DataStack( CoreStoreSchema( modelVersion: "V1", entities: [ Entity<Animal>("Animal"), Entity<Person>("Person") ], versionLock: [ "Animal": [0x2698c812ebbc3b97, 0x751e3fa3f04cf9, 0x51fd460d3babc82, 0x92b4ba735b5a3053], "Person": [0xae4060a59f990ef0, 0x8ac83a6e1411c130, 0xa29fea58e2e38ab6, 0x2071bb7e33d77887] ] ) )See also
CoreStoreObjectSee moreSee also
EntityDeclaration
Swift
public final class CoreStoreSchema : DynamicSchema
-
The
Entity<O>containsNSEntityDescriptionmetadata forCoreStoreObjectsubclasses. Pass theEntityinstances toCoreStoreSchemainitializer.class Animal: CoreStoreObject { let species = Value.Required<String>("species", initial: "") let nickname = Value.Optional<String>("nickname") let master = Relationship.ToOne<Person>("master") } class Person: CoreStoreObject { let name = Value.Required<String>("name", initial: "") let pet = Relationship.ToOne<Animal>("pet", inverse: { $0.master }) } CoreStore.defaultStack = DataStack( CoreStoreSchema( modelVersion: "V1", entities: [ Entity<Animal>("Animal"), Entity<Person>("Person") ] ) )See also
CoreStoreSchemaSee moreSee also
CoreStoreObjectDeclaration
Swift
public final class Entity<O> : DynamicEntity where O : CoreStoreObject
-
A storage interface backed by an SQLite database managed by iCloud.
See moreDeclaration
Swift
@available(*, deprecated, message: "Please see the release notes and Core Data documentation.") public final class ICloudStore : CloudStorage
-
The
ListMonitormonitors changes to a list ofDynamicObjectinstances. Observers that implement theListObserverprotocol may then register themselves to theListMonitor‘saddObserver(_:)method:let monitor = CoreStore.monitorList( From<Person>(), Where("title", isEqualTo: "Engineer"), OrderBy(.ascending("lastName")) ) monitor.addObserver(self)The
ListMonitorinstance needs to be held on (retained) for as long as the list needs to be observed. Observers registered viaaddObserver(_:)are not retained.ListMonitoronly keeps aweakreference to all observers, thus keeping itself free from retain-cycles.Lists created with
monitorList(...)keep a single-section list of objects, where each object can be accessed by index:let firstPerson: MyPersonEntity = monitor[0]Accessing the list with an index above the valid range will raise an exception.
Creating a sectioned-list is also possible with the
monitorSectionedList(...)method:let monitor = CoreStore.monitorSectionedList( From<Person>(), SectionBy("age") { "Age \($0)" }, Where("title", isEqualTo: "Engineer"), OrderBy(.ascending("lastName")) ) monitor.addObserver(self)Objects from
ListMonitors created this way can be accessed either by anIndexPathor a tuple:let indexPath = IndexPath(forItem: 3, inSection: 2) let person1 = monitor[indexPath] let person2 = monitor[2, 3]In the example above, both
See moreperson1andperson2will contain the object at section=2, index=3.Declaration
Swift
@available(OSX 10.12, *) public final class ListMonitor<D> : Hashable where D : DynamicObject
-
The
ObjectMonitormonitors changes to a singleDynamicObjectinstance. Observers that implement theObjectObserverprotocol may then register themselves to theObjectMonitor‘saddObserver(_:)method:let monitor = CoreStore.monitorObject(object) monitor.addObserver(self)The created
ObjectMonitorinstance needs to be held on (retained) for as long as the object needs to be observed.Observers registered via
See moreaddObserver(_:)are not retained.ObjectMonitoronly keeps aweakreference to all observers, thus keeping itself free from retain-cycles.Declaration
Swift
@available(OSX 10.12, *) public final class ObjectMonitor<D> : Equatable where D : DynamicObject
-
The
See moreSchemaHistoryencapsulates multipleDynamicSchemaacross multiple model versions. It contains all model history and is used by theDataStacktoDeclaration
Swift
public final class SchemaHistory : ExpressibleByArrayLiteral
-
The object containing the changeset for an observed
See moreValueContainer.RequiredandValueContainer.Optionalproperty.Declaration
Swift
public final class CoreStoreObjectValueDiff<V> where V : ImportableAttributeType
-
The object containing the changeset for an observed
See moreTransformableContainer.RequiredorTransformableContainer.Optionalproperty.Declaration
Swift
public final class CoreStoreObjectTransformableDiff<V> where V : NSCoding, V : NSCopying
-
The object containing the changeset for an observed
See moreRelationshipContainer.ToOneproperty.Declaration
Swift
public final class CoreStoreObjectObjectDiff<D> where D : CoreStoreObject
-
The object containing the changeset for an observed
See moreRelationshipContainer.ToManyUnorderedproperty.Declaration
Swift
public final class CoreStoreObjectUnorderedDiff<D> where D : CoreStoreObject
-
The object containing the changeset for an observed
See moreRelationshipContainer.Orderedproperty.Declaration
Swift
public final class CoreStoreObjectOrderedDiff<D> where D : CoreStoreObject
-
A
See moreSchemaMappingProviderthat accepts custom mappings for some entities. Mappings of entities with noCustomMappingprovided will be automatically calculated if possible.Declaration
Swift
public class CustomSchemaMappingProvider : Hashable, SchemaMappingProvider
-
The
See moreDefaultLoggeris a basic implementation of theCoreStoreLoggerprotocol.Declaration
Swift
public final class DefaultLogger : CoreStoreLogger
-
A
See moreSchemaMappingProviderthat tries to infer model migration between twoDynamicSchemaversions by searching allxcmappingmodels fromBundle.allBundlesor by relying on lightweight migration if possible. Throws an error if lightweight migration is impossible for the twoDynamicSchema. This mapping is automatically used as a fallback mapping provider, even if no mapping providers are explicitly declared in theStorageInterface.Declaration
Swift
public final class InferredSchemaMappingProvider : Hashable, SchemaMappingProvider
-
The
UserInfoclass is provided by several CoreStore types such asDataStack,ListMonitor,ObjectMonitorand transactions to allow external libraries or user apps to store their own custom data.enum Static { static var myDataKey: Void? } CoreStore.defaultStack.userInfo[&Static.myDataKey] = myObjectSee moreImportant
Do not use this class to store thread-sensitive data.Declaration
Swift
public final class UserInfo
-
A
See moreSchemaMappingProviderthat tries to infer model migration between twoDynamicSchemaversions by loading an xcmappingmodel file from the specifiedBundle. ThrowsCoreStoreError.mappingModelNotFoundif the xcmappingmodel file cannot be found, or if the xcmappingmodel doesn’t resolve the source and destinationDynamicSchema.Declaration
Swift
public final class XcodeSchemaMappingProvider : Hashable, SchemaMappingProvider
View on GitHub
Classes Reference