mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-03-19 16:21:27 +01:00
user #keyPath() for keys in demo app and in unit tests
This commit is contained in:
@@ -99,11 +99,11 @@ public extension CoreStore {
|
||||
}
|
||||
|
||||
/**
|
||||
Creates a `LocalStorageface` of the specified store type with default values and adds it to the `defaultStack`. This method blocks until completion.
|
||||
Creates a `LocalStorageInterface` of the specified store type with default values and adds it to the `defaultStack`. This method blocks until completion.
|
||||
```
|
||||
try CoreStore.addStorageAndWait(SQLiteStore.self)
|
||||
```
|
||||
- parameter storeType: the `LocalStorageface` type
|
||||
- parameter storeType: the `LocalStorageInterface` type
|
||||
- throws: a `CoreStoreError` value indicating the failure
|
||||
- returns: the local storage added to the `defaultStack`
|
||||
*/
|
||||
|
||||
@@ -177,11 +177,11 @@ public final class DataStack {
|
||||
}
|
||||
|
||||
/**
|
||||
Creates a `LocalStorageface` of the specified store type with default values and adds it to the stack. This method blocks until completion.
|
||||
Creates a `LocalStorageInterface` of the specified store type with default values and adds it to the stack. This method blocks until completion.
|
||||
```
|
||||
try dataStack.addStorageAndWait(SQLiteStore.self)
|
||||
```
|
||||
- parameter storeType: the `LocalStorageface` type
|
||||
- parameter storeType: the `LocalStorageInterface` type
|
||||
- throws: a `CoreStoreError` value indicating the failure
|
||||
- returns: the local storage added to the stack
|
||||
*/
|
||||
@@ -424,36 +424,33 @@ public final class DataStack {
|
||||
|
||||
internal func persistentStoreForEntityClass(_ entityClass: AnyClass, configuration: String?, inferStoreIfPossible: Bool) -> (store: NSPersistentStore?, isAmbiguous: Bool) {
|
||||
|
||||
var returnValue: (store: NSPersistentStore?, isAmbiguous: Bool) = (store: nil, isAmbiguous: false)
|
||||
self.storeMetadataUpdateQueue.sync(flags: .barrier) {
|
||||
return self.storeMetadataUpdateQueue.sync(flags: .barrier) { () -> (store: NSPersistentStore?, isAmbiguous: Bool) in
|
||||
|
||||
let configurationsForEntity = self.entityConfigurationsMapping[NSStringFromClass(entityClass)] ?? []
|
||||
if let configuration = configuration {
|
||||
|
||||
if configurationsForEntity.contains(configuration) {
|
||||
|
||||
returnValue = (store: self.configurationStoreMapping[configuration], isAmbiguous: false)
|
||||
return
|
||||
return (store: self.configurationStoreMapping[configuration], isAmbiguous: false)
|
||||
}
|
||||
else if !inferStoreIfPossible {
|
||||
|
||||
return
|
||||
return (store: nil, isAmbiguous: false)
|
||||
}
|
||||
}
|
||||
|
||||
switch configurationsForEntity.count {
|
||||
|
||||
case 0:
|
||||
return
|
||||
return (store: nil, isAmbiguous: false)
|
||||
|
||||
case 1 where inferStoreIfPossible:
|
||||
returnValue = (store: self.configurationStoreMapping[configurationsForEntity.first!], isAmbiguous: false)
|
||||
return (store: self.configurationStoreMapping[configurationsForEntity.first!], isAmbiguous: false)
|
||||
|
||||
default:
|
||||
returnValue = (store: nil, isAmbiguous: true)
|
||||
return (store: nil, isAmbiguous: true)
|
||||
}
|
||||
}
|
||||
return returnValue
|
||||
}
|
||||
|
||||
internal func createPersistentStoreFromStorage(_ storage: StorageInterface, finalURL: URL?, finalStoreOptions: [AnyHashable: Any]?) throws -> NSPersistentStore {
|
||||
|
||||
@@ -34,7 +34,7 @@ import CoreData
|
||||
/**
|
||||
A storage interface backed by an SQLite database managed by iCloud.
|
||||
*/
|
||||
public class ICloudStore: CloudStorage {
|
||||
public final class ICloudStore: CloudStorage {
|
||||
|
||||
/**
|
||||
Initializes an iCloud store interface from the given ubiquitous store information. Returns `nil` if the container could not be located or if iCloud storage is unavailable for the current user or device
|
||||
|
||||
Reference in New Issue
Block a user