Protocols
The following protocols are available globally.
-
The
CSFetchClause
implement clauses used to configureNSFetchRequest
s.See also
FetchClause
Declaration
Swift
@objc public protocol CSFetchClause
-
The
CSQueryClause
implement clauses used to configureNSFetchRequest
s.See also
QueryClause
Declaration
Swift
@objc public protocol CSQueryClause
-
The
CSDeleteClause
implement clauses used to configureNSFetchRequest
s.See also
DeleteClause
Declaration
Swift
@objc public protocol CSDeleteClause
-
The
CSDynamicSchema
serves as the Objective-C bridging type forDynamicSchema
.See also
DynamicSchema
Declaration
Swift
@objc public protocol CSDynamicSchema
-
Implement the
CSListObserver
protocol to observe changes to a list ofNSManagedObject
s.CSListObserver
s 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 also
ListObserver
Declaration
Swift
@available(OSX 10.12, *) @objc public protocol CSListObserver : AnyObject
-
Implement the
CSListObjectObserver
protocol to observe detailed changes to a list’s object.CSListObjectObserver
s 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 also
ListObjectObserver
Declaration
Swift
@available(OSX 10.12, *) @objc public protocol CSListObjectObserver : CSListObserver
-
Implement the
CSListSectionObserver
protocol to observe changes to a list’s section info.CSListSectionObserver
s 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 also
ListSectionObserver
Declaration
Swift
@available(OSX 10.12, *) @objc public protocol CSListSectionObserver : CSListObjectObserver
-
Implement the
CSObjectObserver
protocol to observe changes to a singleNSManagedObject
instance.CSObjectObserver
s may register themselves to aCSObjectMonitor
‘s-addObjectObserver:
method:CSObjectMonitor *monitor = [CSCoreStore monitorObject:myObject]; [monitor addObjectObserver:self];
See also
ObjectObserver
Declaration
Swift
@available(OSX 10.12, *) @objc public protocol CSObjectObserver : AnyObject
-
The
CSStorageInterface
serves as the Objective-C bridging type forStorageInterface
.See also
StorageInterface
Declaration
Swift
@objc public protocol CSStorageInterface
-
The
CSLocalStorage
serves as the Objective-C bridging type forLocalStorage
.See also
LocalStorage
Declaration
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 moreCoreStoreObjectiveCType
s are Objective-C accessible classes that represent CoreStore’s Swift types.Declaration
Swift
public protocol CoreStoreObjectiveCType : AnyObject
-
See moreCoreStoreSwiftType
s are CoreStore’s Swift types that are bridgeable to Objective-C.Declaration
Swift
public protocol CoreStoreSwiftType
-
Custom loggers should implement the
See moreCoreStoreLogger
protocol 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
CoreStoreObject
properties. Make sure to retain this instance to keep observing notifications.
See moreinvalidate()
will be called automatically when anCoreStoreObjectKeyValueObservation
is deinited.Declaration
Swift
public protocol CoreStoreObjectKeyValueObservation : AnyObject
-
All CoreStore’s utilities are designed around
See moreDynamicObject
instances.NSManagedObject
andCoreStoreObject
instances all conform toDynamicObject
.Declaration
Swift
public protocol DynamicObject : AnyObject
-
Used only for utility methods.
See moreDeclaration
Swift
public protocol DynamicKeyPath : AnyDynamicKeyPath
-
DynamicSchema
are types that provideNSManagedObjectModel
instances 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 forCoreStoreObject
Swift 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 asDataStack
s 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
NSManagedObject
andCoreStoreObject
property 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,
RawRepresentable
types whoseRawValue
already implementsImportableAttributeType
only need to declare conformance toImportableAttributeType
.Declaration
Swift
public protocol ImportableAttributeType : QueryableAttributeType
-
NSManagedObject
andCoreStoreObject
subclasses that conform to theImportableObject
protocol 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
-
NSManagedObject
subclasses that conform to theImportableUniqueObject
protocol 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
Value
generic type toKeyPath
utilities.Declaration
Swift
public protocol AllowedObjectiveCKeyPathValue
-
Used only for utility methods. Types allowed as
Value
generic type toKeyPath
utilities.Declaration
Swift
public protocol AllowedOptionalObjectiveCKeyPathValue : AllowedObjectiveCKeyPathValue
-
Used only for utility methods. Types allowed as
Value
generic type toKeyPath
utilities.Declaration
Swift
public protocol AllowedObjectiveCCollectionKeyPathValue : AllowedOptionalObjectiveCKeyPathValue
-
Used only for utility methods. Types allowed as
Value
generic type toKeyPath
utilities.Declaration
Swift
public protocol AllowedCoreStoreObjectKeyPathValue : DynamicKeyPath
-
Used only for utility methods. Types allowed as
Value
generic type toKeyPath
utilities.Declaration
Swift
public protocol AllowedCoreStoreObjectCollectionKeyPathValue : AllowedCoreStoreObjectKeyPathValue
-
Implement the
ListObserver
protocol to observe changes to a list ofNSManagedObject
s.ListObserver
s 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
ListObjectObserver
protocol to observe detailed changes to a list’s object.ListObjectObserver
s 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
ListSectionObserver
protocol to observe changes to a list’s section info.ListSectionObserver
s 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
ObjectObserver
protocol to observe changes to a singleDynamicObject
instance.ObjectObserver
s 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
Select
clauses. Supported default types:Bool
CGFloat
Data
Date
Double
Float
Int
Int8
Int16
Int32
Int64
NSData
NSDate
NSDecimalNumber
NSManagedObjectID
NSNull
NSNumber
NSString
NSURL
NSUUID
String
URL
UUID
In addition,
See moreRawRepresentable
types whoseRawValue
already implementsQueryableAttributeType
only need to declare conformance toQueryableAttributeType
.Declaration
Swift
public protocol QueryableAttributeType : SelectResultType, Hashable
-
Encapsulates containers which manages an internal
See moreNSManagedObjectContext
, such asDataStack
s 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 moreSchemaMappingProvider
provides migration mapping information between twoDynamicSchema
versions.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
SelectResultType
protocol is implemented by return types supported by theSelect
clause.Declaration
Swift
public protocol SelectResultType
-
The
SelectAttributesResultType
protocol is implemented by return types supported by thequeryAttributes(...)
methods.Declaration
Swift
public protocol SelectAttributesResultType : SelectResultType
-
The
See moreStorageInterface
represents the data store managed (or to be managed) by theDataStack
. When added to theDataStack
, theStorageInterface
serves as the interface for theNSPersistentStore
. This may be a database file, an in-memory store, etc.Declaration
Swift
public protocol StorageInterface : AnyObject
-
The
See moreLocalStorage
representsStorageInterface
s that are backed by local files.Declaration
Swift
public protocol LocalStorage : StorageInterface
-
The
See moreCloudStorage
representsStorageInterface
s that are synchronized from a cloud-based store.Declaration
Swift
public protocol CloudStorage : StorageInterface
-
The
FetchClause
implement clauses used to configureNSFetchRequest
s.Declaration
Swift
public protocol FetchClause
-
The
QueryClause
implement clauses used to configureNSFetchRequest
s.Declaration
Swift
public protocol QueryClause : FetchClause
-
The
DeleteClause
implement clauses used to configureNSFetchRequest
s.Declaration
Swift
public protocol DeleteClause : FetchClause
-
Declaration
Swift
public protocol AnyWhereClause : DeleteClause, QueryClause
-
Used only for
Where.Expression
type constraints. Currently supportsSingleTarget
andCollectionTarget
.Declaration
Swift
public protocol WhereExpressionTrait
-
Abstracts the
See moreWhere
clause for protocol utilities. Typically used only for utility method generic constraints.Declaration
Swift
public protocol WhereClauseType : AnyWhereClause