DataStoreManagerDataSource
@objc
public protocol DataStoreManagerDataSource : AnyObject
The methods adopted by the object you use to manage data for a data store manager.
-
Type to mean instance of LAContext.
Declaration
Swift
typealias LocalAuthenticationContext = LAContext
-
Type to mean instance of LAContext.
-
Asks the data source for the default storage type for the data store manager.
Declaration
Swift
@objc optional func defaultStorageType(for manager: DataStoreManager) -> DataStoreStorageType
Parameters
manager
An object representing the data store manager requesting this information.
Return Value
The default storage type of the data store manager.
-
Asks the data source for the current schema version for the storage type of data store manager.
Declaration
Swift
@objc optional func dataStoreManager(_ manager: DataStoreManager, currentSchemaVersionForType type: DataStoreStorageType) -> Int
Parameters
manager
An object representing the data store manager requesting this information.
type
A storage type constant.
Return Value
The current schema version number for the storage type of the data store manager.
-
Asks the data source for the suite name for
UserDefaults
of the data store manager.Declaration
Swift
@objc optional func userDefaultsSuiteName(for manager: DataStoreManager) -> String
Parameters
manager
An object representing the data store manager requesting this information.
Return Value
The
UserDefaults
suite name for the data store manager.
-
Asks the data source for the maximum total cost that the cache can hold before it starts evicting objects.
If
0
, there is no total cost limit. The default value is0
.When you add an object to the cache, you may pass in a specified cost for the object, such as the size in bytes of the object. If adding this object to the cache causes the cache’s total cost to rise above
totalCostLimit
, the cache may automatically evict objects until its total cost falls belowtotalCostLimit
. The order in which the cache evicts objects is not guaranteed.This is not a strict limit, and if the cache goes over the limit, an object in the cache could be evicted instantly, at a later point in time, or possibly never, all depending on the implementation details of the cache.
Declaration
Swift
@objc optional func cacheTotalCostLimit(for manager: DataStoreManager) -> Int
Parameters
manager
An object representing the data store manager requesting this information.
Return Value
The number of total cost limit.
-
Asks the data source for the maximum number of objects the cache should hold.
If
0
, there is no count limit. The default value is0
.This is not a strict limit—if the cache goes over the limit, an object in the cache could be evicted instantly, later, or possibly never, depending on the implementation details of the cache.
Declaration
Swift
@objc optional func cacheCountLimit(for manager: DataStoreManager) -> Int
Parameters
manager
An object representing the data store manager requesting this information.
Return Value
The number of count limit.
-
Returns a description of an entity in Core Data.
Declaration
Swift
@objc optional func coreDataEntityDescription(for manager: DataStoreManager) -> NSEntityDescription
Parameters
manager
An object representing the data store manager requesting this information.
Return Value
A description of an entity in Core Data.
-
Returns An object space that you use to manipulate and track changes to managed objects.
Declaration
Swift
@objc optional func coreDataManagedObjectContext(for manager: DataStoreManager) -> NSManagedObjectContext
Parameters
manager
An object representing the data store manager requesting this information.
Return Value
An object space that you use to manipulate and track changes to managed objects.
-
Asks the data source for the generic keychain service of the data store manager.
Declaration
Swift
@objc optional func genericKeychainService(for manager: DataStoreManager) -> String
Parameters
manager
An object representing the data store manager requesting this information.
Return Value
The corresponding value is a string that represents the service associated with this item.
-
Asks the data source for the generic keychain access group of the data store manager.
For an app to access a keychain item, one of the groups to which the app belongs must be the item’s group. The list of an app’s access groups consists of the following string identifiers, in this order:
- The strings in the app’s Keychain Access Groups Entitlement
- The app ID string
- The strings in the App Groups Entitlement
Two or more apps that are in the same access group can share keychain items. For more details, see Sharing Access to Keychain Items Among a Collection of Apps.
If you don’t explicitly set a group, keychain services defaults to the app’s first access group, which is either the first keychain access group, or the app ID when the app has no keychain groups. In the latter case, the item is only accessible to the app creating the item, since no other app can be in that group.
Declaration
Swift
@objc optional func genericKeychainAccessGroup(for manager: DataStoreManager) -> String
Parameters
manager
An object representing the data store manager requesting this information.
Return Value
The corresponding value is a string that indicates the item’s one and only access group.
-
Returns a value that identifies the location of a resource, such as an item on a remote server or the path to a local file.
Declaration
Swift
@objc optional func internetKeychainServer(for manager: DataStoreManager) -> URL
Parameters
manager
An object representing the data store manager requesting this information.
Return Value
A value that identifies the location of a resource, such as an item on a remote server or the path to a local file.
-
Returns a value that provide information regarding protocol type of data store manager.
Declaration
Swift
@objc optional func internetKeychainProtocolType(for manager: DataStoreManager) -> DataStoreProtocolType
Parameters
manager
An object representing the data store manager requesting this information.
Return Value
A value that provide information regarding protocol type of data store manager.
-
Returns a value that provide information regarding authentication type of data store manager.
Declaration
Swift
@objc optional func internetKeychainAuthenticationType(for manager: DataStoreManager) -> DataStoreAuthenticationType
Parameters
manager
An object representing the data store manager requesting this information.
Return Value
A value that provide information regarding authentication type of data store manager.
-
Asks the data source to verify that the keychain of the data store manager is synchronized through iCloud.
Declaration
Swift
@objc optional func keychainIsSynchronizable(for manager: DataStoreManager) -> Bool
Parameters
manager
An object representing the data store manager requesting this information.
Return Value
true
if the item is synchronized through iCloud; otherwisefalse
. -
Asks the data source for the keychain operation prompt of the data store manager.
Declaration
Swift
@available(iOS 8.0, OSX 10.10, *) @available(watchOS, unavailable) @available(tvOS, unavailable) @objc optional func keychainOperationPrompt(for manager: DataStoreManager) -> String
Parameters
manager
An object representing the data store manager requesting this information.
Return Value
The corresponding value is a string describing the operation for which the app is attempting to authenticate. When performing user authentication, the system includes the string in the user prompt. The app is responsible for text localization.
-
Asks the data source for the keychain local authentication context to use of the data store manager.
It is according to the following rules:
- If this key is not specified, and if the item requires authentication, a new context will be created, used once, and discarded.
- If this key is specified with a context that has been previously authenticated, the operation will succeed without asking user for authentication.
If this key is specified with a context that has not been previously authenticated, the system attempts authentication on the context. If successful, the context may be reused in subsequent keychain operations.
Important
Include the NSFaceIDUsageDescription key in your app’s Info.plist file if your app allows biometric authentication. Otherwise, authorization requests may fail.
Declaration
Swift
@available(iOS 8.0, OSX 10.10, *) @available(watchOS, unavailable) @available(tvOS, unavailable) @objc optional func keychainLocalAuthenticationContext(for manager: DataStoreManager) -> LocalAuthenticationContext
Parameters
manager
An object representing the data store manager requesting this information.
Return Value
The corresponding value is of type LAContext, and represents a reusable local authentication context that should be used for keychain item authentication.
-
Asks the data source for the containerIdentifier for
CloudKit
of the data store manager.Declaration
Swift
@objc optional func cloudKitContainerIdentifier(for manager: DataStoreManager) -> String
Parameters
manager
An object representing the data store manager requesting this information.
Return Value
The
CloudKit
containerIdentifier for the data store manager. -
Asks the data source for the cloud kit container record type of the data store manager.
Use this string to differentiate between different record types in your app. The string is primarily for your benefit, so choose type names that reflect the data in the corresponding records.
Declaration
Swift
@objc optional func cloudKitContainerRecordType(for manager: DataStoreManager) -> String
Parameters
manager
An object representing the data store manager requesting this information.
Return Value
The app-defined string that identifies the type of the record.
-
Returns a definition of logical conditions used to constrain a search either for a fetch or for in-memory filtering.
Declaration
Swift
@objc optional func cloudKitContainerPredicate(for manager: DataStoreManager) -> NSPredicate
Parameters
manager
An object representing the data store manager requesting this information.
Return Value
A definition of logical conditions used to constrain a search either for a fetch or for in-memory filtering.
-
Returns an object that uniquely identifies a record zone in a database.
Declaration
Swift
@available(watchOSApplicationExtension 3.0, *) @objc optional func cloudKitContainerZoneID(for manager: DataStoreManager) -> CKRecordZone.ID
Parameters
manager
An object representing the data store manager requesting this information.
Return Value
An object that uniquely identifies a record zone in a database.
-
Asks the data source to verify that the cloud kit container of data source manager allows duplicate key.
If you do not implement this method, the data store manager configures does not allow duplicate key.
Declaration
Swift
@objc optional func cloudKitContainerAllowsDuplicateKey(for manager: DataStoreManager) -> Bool
Parameters
manager
An object representing the data store manager requesting this information.
Return Value
true
if the key allowed to be duplicated; otherwisefalse
.