Protocols
The following protocols are available globally.
-
The
CSFetchClauseimplement clauses used to configureNSFetchRequests.See also
FetchClauseDeclaration
Swift
@objc public protocol CSFetchClause
-
The
CSQueryClauseimplement clauses used to configureNSFetchRequests.See also
QueryClauseDeclaration
Swift
@objc public protocol CSQueryClause
-
The
CSDeleteClauseimplement clauses used to configureNSFetchRequests.See also
DeleteClauseDeclaration
Swift
@objc public protocol CSDeleteClause
-
The
CSDynamicSchemaserves as the Objective-C bridging type forDynamicSchema.See moreSee also
DynamicSchemaDeclaration
Swift
@objc public protocol CSDynamicSchema
-
Implement the
CSListObserverprotocol to observe changes to a list ofNSManagedObjects.CSListObservers may register themselves to aCSListMonitor‘s-addListObserver:method:CSListMonitor *monitor = [CSCoreStore monitorListFrom:[CSFrom entityClass:[MyPersonEntity class]] fetchClauses:@[[CSOrderBy sortDescriptor:[CSSortKey withKeyPath:@"lastName" ascending:YES]]]]; [monitor addListObserver:self];See moreSee also
ListObserverDeclaration
Swift
@available(OSX 10.12, *) @objc public protocol CSListObserver : AnyObject
-
Implement the
CSListObjectObserverprotocol to observe detailed changes to a list’s object.CSListObjectObservers may register themselves to aCSListMonitor‘s-addListObjectObserver(_:)method:CSListMonitor *monitor = [CSCoreStore monitorListFrom:[CSFrom entityClass:[MyPersonEntity class]] fetchClauses:@[[CSOrderBy sortDescriptor:[CSSortKey withKeyPath:@"lastName" ascending:YES]]]]; [monitor addListObjectObserver:self];See moreSee also
ListObjectObserverDeclaration
Swift
@available(OSX 10.12, *) @objc public protocol CSListObjectObserver : CSListObserver
-
Implement the
CSListSectionObserverprotocol to observe changes to a list’s section info.CSListSectionObservers may register themselves to aCSListMonitor‘s-addListSectionObserver:method:CSListMonitor *monitor = [CSCoreStore monitorSectionedListFrom:[CSFrom entityClass:[MyPersonEntity class]] sectionBy:[CSSectionBy keyPath:@"age"] fetchClauses:@[[CSOrderBy sortDescriptor:[CSSortKey withKeyPath:@"lastName" ascending:YES]]]]; [monitor addListSectionObserver:self];See moreSee also
ListSectionObserverDeclaration
Swift
@available(OSX 10.12, *) @objc public protocol CSListSectionObserver : CSListObjectObserver
-
Implement the
CSObjectObserverprotocol to observe changes to a singleNSManagedObjectinstance.CSObjectObservers may register themselves to aCSObjectMonitor‘s-addObjectObserver:method:CSObjectMonitor *monitor = [CSCoreStore monitorObject:myObject]; [monitor addObjectObserver:self];See moreSee also
ObjectObserverDeclaration
Swift
@available(OSX 10.12, *) @objc public protocol CSObjectObserver : AnyObject
-
The
CSStorageInterfaceserves as the Objective-C bridging type forStorageInterface.See moreSee also
StorageInterfaceDeclaration
Swift
@objc public protocol CSStorageInterface
-
The
CSLocalStorageserves as the Objective-C bridging type forLocalStorage.See moreSee also
LocalStorageDeclaration
Swift
@objc public protocol CSLocalStorage : CSStorageInterface
-
Objective-C Foundation types that are natively supported by Core Data managed attributes all conform to
CoreDataNativeType.Declaration
Swift
@objc public protocol CoreDataNativeType : AnyObject, NSObjectProtocol
-
See moreCoreStoreObjectiveCTypes are Objective-C accessible classes that represent CoreStore’s Swift types.Declaration
Swift
public protocol CoreStoreObjectiveCType : AnyObject
-
See moreCoreStoreSwiftTypes are CoreStore’s Swift types that are bridgeable to Objective-C.Declaration
Swift
public protocol CoreStoreSwiftType
-
Custom loggers should implement the
See moreCoreStoreLoggerprotocol and pass its instance toCoreStore.logger. Calls tolog(...),assert(...), andabort(...)are not tied to a specific queue/thread, so it is the implementer’s job to handle thread-safety.Declaration
Swift
public protocol CoreStoreLogger
-
Observation token for
CoreStoreObjectproperties. Make sure to retain this instance to keep observing notifications.
See moreinvalidate()will be called automatically when anCoreStoreObjectKeyValueObservationis deinited.Declaration
Swift
public protocol CoreStoreObjectKeyValueObservation : AnyObject
-
All CoreStore’s utilities are designed around
See moreDynamicObjectinstances.NSManagedObjectandCoreStoreObjectinstances all conform toDynamicObject.Declaration
Swift
public protocol DynamicObject : AnyObject
-
Used only for utility methods.
See moreDeclaration
Swift
public protocol DynamicKeyPath : AnyDynamicKeyPath
-
DynamicSchemaare types that provideNSManagedObjectModelinstances for a single model version. CoreStore currently supports the following concrete types:XcodeDataModelSchema: describes models loaded from a .xcdatamodeld file.UnsafeDataModelSchema: describes models loaded directly from an existingNSManagedObjectModel. It is not advisable to continue using this model as its metadata are not available to CoreStore.CoreStoreSchema: describes models written forCoreStoreObjectSwift class declarations.
Declaration
Swift
public protocol DynamicSchema
-
Utility protocol for
See moreFetchChainBuilder. Used in fetch methods that support chained fetch builders.Declaration
Swift
public protocol FetchChainableBuilderType
-
Encapsulates containers which manages an internal
See moreNSManagedObjectContext, such asDataStacks and transactions, that can be used for fetching objects. CoreStore provides implementations for this protocol and should be used as a read-only abstraction.Declaration
Swift
public protocol FetchableSource : AnyObject
-
Types supported by CoreStore as
NSManagedObjectandCoreStoreObjectproperty types. Supported default types:- Bool
- CGFloat
- Data
Date
Date- Double
- Float
- Int
- Int8
- Int16
- Int32
- Int64
- NSData
- NSDate
- NSDecimalNumber
- NSNumber
- NSString
- NSURL
- NSUUID
- String
- URL
- UUID
In addition,
RawRepresentabletypes whoseRawValuealready implementsImportableAttributeTypeonly need to declare conformance toImportableAttributeType.Declaration
Swift
public protocol ImportableAttributeType : QueryableAttributeType
-
NSManagedObjectandCoreStoreObjectsubclasses that conform to theImportableObjectprotocol can be imported from a specifiedImportSource. This allows transactions to create and insert instances this way:
See moreclass Person: NSManagedObject, ImportableObject { typealias ImportSource = NSDictionary // ... } CoreStore.perform( asynchronous: { (transaction) -> Void in let json: NSDictionary = // ... let person = try transaction.importObject( Into<Person>(), source: json ) // ... }, completion: { (result) in // ... } )Declaration
Swift
public protocol ImportableObject : DynamicObject
-
NSManagedObjectsubclasses that conform to theImportableUniqueObjectprotocol can be imported from a specifiedImportSource. This allows transactions to either update existing objects or create new instances this way:
See moreclass Person: NSManagedObject, ImportableObject { typealias ImportSource = NSDictionary typealias UniqueIDType = NSString // ... } CoreStore.perform( asynchronous: { (transaction) -> Void in let json: NSDictionary = // ... let person = try transaction.importUniqueObject( Into<Person>(), source: json ) // ... }, completion: { (result) in // ... } )Declaration
Swift
public protocol ImportableUniqueObject : ImportableObject
-
Used only for utility methods. Types allowed as
Valuegeneric type toKeyPathutilities.Declaration
Swift
public protocol AllowedObjectiveCKeyPathValue
-
Used only for utility methods. Types allowed as
Valuegeneric type toKeyPathutilities.Declaration
Swift
public protocol AllowedOptionalObjectiveCKeyPathValue : AllowedObjectiveCKeyPathValue
-
Used only for utility methods. Types allowed as
Valuegeneric type toKeyPathutilities.Declaration
Swift
public protocol AllowedObjectiveCCollectionKeyPathValue : AllowedOptionalObjectiveCKeyPathValue
-
Used only for utility methods. Types allowed as
Valuegeneric type toKeyPathutilities.Declaration
Swift
public protocol AllowedCoreStoreObjectKeyPathValue : DynamicKeyPath
-
Used only for utility methods. Types allowed as
Valuegeneric type toKeyPathutilities.Declaration
Swift
public protocol AllowedCoreStoreObjectCollectionKeyPathValue : AllowedCoreStoreObjectKeyPathValue
-
Implement the
ListObserverprotocol to observe changes to a list ofNSManagedObjects.ListObservers may register themselves to aListMonitor‘saddObserver(_:)method:
See morelet monitor = CoreStore.monitorList( From<Person>(), OrderBy(.ascending("lastName")) ) monitor.addObserver(self)Declaration
Swift
@available(OSX 10.12, *) public protocol ListObserver : AnyObject
-
Implement the
ListObjectObserverprotocol to observe detailed changes to a list’s object.ListObjectObservers may register themselves to aListMonitor‘saddObserver(_:)method:
See morelet monitor = CoreStore.monitorList( From<MyPersonEntity>(), OrderBy(.ascending("lastName")) ) monitor.addObserver(self)Declaration
Swift
@available(OSX 10.12, *) public protocol ListObjectObserver : ListObserver
-
Implement the
ListSectionObserverprotocol to observe changes to a list’s section info.ListSectionObservers may register themselves to aListMonitor‘saddObserver(_:)method:
See morelet monitor = CoreStore.monitorSectionedList( From<MyPersonEntity>(), SectionBy("age") { "Age \($0)" }, OrderBy(.ascending("lastName")) ) monitor.addObserver(self)Declaration
Swift
@available(OSX 10.12, *) public protocol ListSectionObserver : ListObjectObserver
-
Implement the
ObjectObserverprotocol to observe changes to a singleDynamicObjectinstance.ObjectObservers may register themselves to aObjectMonitor‘saddObserver(_:)method:
See morelet monitor = CoreStore.monitorObject(object) monitor.addObserver(self)Declaration
Swift
@available(OSX 10.12, *) public protocol ObjectObserver : AnyObject
-
Utility protocol for
See moreQueryChainBuilder. Used in fetch methods that support chained query builders.Declaration
Swift
public protocol QueryChainableBuilderType
-
Types supported by CoreStore for querying, especially as generic type for
Selectclauses. Supported default types:BoolCGFloatDataDateDoubleFloatIntInt8Int16Int32Int64NSDataNSDateNSDecimalNumberNSManagedObjectIDNSNullNSNumberNSStringNSURLNSUUIDStringURLUUID
In addition,
See moreRawRepresentabletypes whoseRawValuealready implementsQueryableAttributeTypeonly need to declare conformance toQueryableAttributeType.Declaration
Swift
public protocol QueryableAttributeType : SelectResultType, Hashable
-
Encapsulates containers which manages an internal
See moreNSManagedObjectContext, such asDataStacks and transactions, that can be used for querying values. CoreStore provides implementations for this protocol and should be used as a read-only abstraction.Declaration
Swift
public protocol QueryableSource : AnyObject
-
The
See moreSchemaMappingProviderprovides migration mapping information between twoDynamicSchemaversions.Declaration
Swift
public protocol SchemaMappingProvider
-
Utility protocol for
See moreSectionMonitorChainBuilder. Used in methods that support chained fetch builders.Declaration
Swift
@available(OSX 10.12, *) public protocol SectionMonitorBuilderType
-
The
SelectResultTypeprotocol is implemented by return types supported by theSelectclause.Declaration
Swift
public protocol SelectResultType
-
The
SelectAttributesResultTypeprotocol is implemented by return types supported by thequeryAttributes(...)methods.Declaration
Swift
public protocol SelectAttributesResultType : SelectResultType
-
The
See moreStorageInterfacerepresents the data store managed (or to be managed) by theDataStack. When added to theDataStack, theStorageInterfaceserves as the interface for theNSPersistentStore. This may be a database file, an in-memory store, etc.Declaration
Swift
public protocol StorageInterface : AnyObject
-
The
See moreLocalStoragerepresentsStorageInterfaces that are backed by local files.Declaration
Swift
public protocol LocalStorage : StorageInterface
-
The
See moreCloudStoragerepresentsStorageInterfaces that are synchronized from a cloud-based store.Declaration
Swift
public protocol CloudStorage : StorageInterface
-
The
FetchClauseimplement clauses used to configureNSFetchRequests.Declaration
Swift
public protocol FetchClause
-
The
QueryClauseimplement clauses used to configureNSFetchRequests.Declaration
Swift
public protocol QueryClause : FetchClause
-
The
DeleteClauseimplement clauses used to configureNSFetchRequests.Declaration
Swift
public protocol DeleteClause : FetchClause
-
Declaration
Swift
public protocol AnyWhereClause : DeleteClause, QueryClause
-
Used only for
Where.Expressiontype constraints. Currently supportsSingleTargetandCollectionTarget.Declaration
Swift
public protocol WhereExpressionTrait
-
Abstracts the
See moreWhereclause for protocol utilities. Typically used only for utility method generic constraints.Declaration
Swift
public protocol WhereClauseType : AnyWhereClause
View on GitHub
Protocols Reference