diff --git a/README.md b/README.md index dc6e40f..57e5788 100644 --- a/README.md +++ b/README.md @@ -307,8 +307,8 @@ public protocol LocalStorage: StorageInterface { var fileURL: NSURL { get } var mappingModelBundles: [NSBundle] { get } var localStorageOptions: LocalStorageOptions { get } - func storeOptionsForOptions(options: LocalStorageOptions) -> [String: AnyObject]? - func eraseStorageAndWait(soureModel soureModel: NSManagedObjectModel) throws + func dictionary(forOptions: LocalStorageOptions) -> [String: AnyObject]? + func eraseStorageAndWait(soureModel: NSManagedObjectModel) throws } ``` If you have custom `NSIncrementalStore` or `NSAtomicStore` subclasses, you can implement this protocol and use it similarly to `SQLiteStore`. diff --git a/Sources/Migrating/DataStack+Migration.swift b/Sources/Migrating/DataStack+Migration.swift index 711c3be..88fa7ba 100644 --- a/Sources/Migrating/DataStack+Migration.swift +++ b/Sources/Migrating/DataStack+Migration.swift @@ -355,7 +355,7 @@ public extension DataStack { var cloudStorageOptions = storage.cloudStorageOptions cloudStorageOptions.remove(.recreateLocalStoreOnModelMismatch) - let storeOptions = storage.storeOptionsForOptions(cloudStorageOptions) + let storeOptions = storage.dictionary(forOptions: cloudStorageOptions) do { try FileManager.default.createDirectory( diff --git a/Sources/Setup/DataStack.swift b/Sources/Setup/DataStack.swift index 559b943..59eed98 100644 --- a/Sources/Setup/DataStack.swift +++ b/Sources/Setup/DataStack.swift @@ -103,7 +103,7 @@ public final class DataStack { /** Returns the `NSManagedObjectID` for the specified object URI if it exists in the persistent store. */ - public func objectIDForURIRepresentation(_ url: URL) -> NSManagedObjectID? { + public func objectID(forURIRepresentation url: URL) -> NSManagedObjectID? { return self.coordinator.managedObjectID(forURIRepresentation: url) } @@ -237,7 +237,7 @@ public final class DataStack { var localStorageOptions = storage.localStorageOptions localStorageOptions.remove(.recreateStoreOnModelMismatch) - let storeOptions = storage.storeOptionsForOptions(localStorageOptions) + let storeOptions = storage.dictionary(forOptions: localStorageOptions) do { try FileManager.default.createDirectory( @@ -332,7 +332,7 @@ public final class DataStack { var cloudStorageOptions = storage.cloudStorageOptions cloudStorageOptions.remove(.recreateLocalStoreOnModelMismatch) - let storeOptions = storage.storeOptionsForOptions(cloudStorageOptions) + let storeOptions = storage.dictionary(forOptions: cloudStorageOptions) do { try FileManager.default.createDirectory( @@ -515,6 +515,12 @@ public final class DataStack { return self.entityDescription(for: type) } + + @available(*, deprecated: 3.0.0, renamed: "objectID(forURIRepresentation:)") + public func objectIDForURIRepresentation(_ url: URL) -> NSManagedObjectID? { + + return self.objectID(forURIRepresentation: url) + } } diff --git a/Sources/Setup/StorageInterfaces/ICloudStore.swift b/Sources/Setup/StorageInterfaces/ICloudStore.swift index f8d65ce..7402814 100644 --- a/Sources/Setup/StorageInterfaces/ICloudStore.swift +++ b/Sources/Setup/StorageInterfaces/ICloudStore.swift @@ -400,7 +400,7 @@ public final class ICloudStore: CloudStorage { /** The options dictionary for the specified `CloudStorageOptions` */ - public func storeOptionsForOptions(_ options: CloudStorageOptions) -> [AnyHashable: Any]? { + public func dictionary(forOptions options: CloudStorageOptions) -> [AnyHashable: Any]? { if options == .none { diff --git a/Sources/Setup/StorageInterfaces/LegacySQLiteStore.swift b/Sources/Setup/StorageInterfaces/LegacySQLiteStore.swift index 3e7b842..85ca37c 100644 --- a/Sources/Setup/StorageInterfaces/LegacySQLiteStore.swift +++ b/Sources/Setup/StorageInterfaces/LegacySQLiteStore.swift @@ -99,7 +99,7 @@ public final class LegacySQLiteStore: LocalStorage, DefaultInitializableStore { /** The options dictionary for the specified `LocalStorageOptions` */ - public func storeOptionsForOptions(_ options: LocalStorageOptions) -> [AnyHashable: Any]? { + public func dictionary(forOptions options: LocalStorageOptions) -> [AnyHashable: Any]? { if options == .none { diff --git a/Sources/Setup/StorageInterfaces/SQLiteStore.swift b/Sources/Setup/StorageInterfaces/SQLiteStore.swift index 517c8d1..37858d6 100644 --- a/Sources/Setup/StorageInterfaces/SQLiteStore.swift +++ b/Sources/Setup/StorageInterfaces/SQLiteStore.swift @@ -143,7 +143,7 @@ public final class SQLiteStore: LocalStorage, DefaultInitializableStore { /** The options dictionary for the specified `LocalStorageOptions` */ - public func storeOptionsForOptions(_ options: LocalStorageOptions) -> [AnyHashable: Any]? { + public func dictionary(forOptions options: LocalStorageOptions) -> [AnyHashable: Any]? { if options == .none { diff --git a/Sources/Setup/StorageInterfaces/StorageInterface.swift b/Sources/Setup/StorageInterfaces/StorageInterface.swift index ba71e38..84a459b 100644 --- a/Sources/Setup/StorageInterfaces/StorageInterface.swift +++ b/Sources/Setup/StorageInterfaces/StorageInterface.swift @@ -153,7 +153,7 @@ public protocol LocalStorage: StorageInterface { /** The options dictionary for the specified `LocalStorageOptions` */ - func storeOptionsForOptions(_ options: LocalStorageOptions) -> [AnyHashable: Any]? + func dictionary(forOptions options: LocalStorageOptions) -> [AnyHashable: Any]? /** Called by the `DataStack` to perform actual deletion of the store file from disk. **Do not call directly!** The `sourceModel` argument is a hint for the existing store's model version. Implementers can use the `sourceModel` to perform necessary store operations. (SQLite stores for example, can convert WAL journaling mode to DELETE before deleting) @@ -237,7 +237,7 @@ public protocol CloudStorage: StorageInterface { /** The options dictionary for the specified `CloudStorageOptions` */ - func storeOptionsForOptions(_ options: CloudStorageOptions) -> [AnyHashable: Any]? + func dictionary(forOptions options: CloudStorageOptions) -> [AnyHashable: Any]? /** Called by the `DataStack` to perform actual deletion of the store file from disk. **Do not call directly!** The `sourceModel` argument is a hint for the existing store's model version. Implementers can use the `sourceModel` to perform necessary store operations. (Cloud stores for example, can set the NSPersistentStoreRemoveUbiquitousMetadataOption option before deleting)