mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-04-11 03:36:51 +02:00
WIP: Renaming to meet Swift 3 API guidelines
This commit is contained in:
@@ -307,8 +307,8 @@ public protocol LocalStorage: StorageInterface {
|
|||||||
var fileURL: NSURL { get }
|
var fileURL: NSURL { get }
|
||||||
var mappingModelBundles: [NSBundle] { get }
|
var mappingModelBundles: [NSBundle] { get }
|
||||||
var localStorageOptions: LocalStorageOptions { get }
|
var localStorageOptions: LocalStorageOptions { get }
|
||||||
func storeOptionsForOptions(options: LocalStorageOptions) -> [String: AnyObject]?
|
func dictionary(forOptions: LocalStorageOptions) -> [String: AnyObject]?
|
||||||
func eraseStorageAndWait(soureModel soureModel: NSManagedObjectModel) throws
|
func eraseStorageAndWait(soureModel: NSManagedObjectModel) throws
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
If you have custom `NSIncrementalStore` or `NSAtomicStore` subclasses, you can implement this protocol and use it similarly to `SQLiteStore`.
|
If you have custom `NSIncrementalStore` or `NSAtomicStore` subclasses, you can implement this protocol and use it similarly to `SQLiteStore`.
|
||||||
|
|||||||
@@ -355,7 +355,7 @@ public extension DataStack {
|
|||||||
var cloudStorageOptions = storage.cloudStorageOptions
|
var cloudStorageOptions = storage.cloudStorageOptions
|
||||||
cloudStorageOptions.remove(.recreateLocalStoreOnModelMismatch)
|
cloudStorageOptions.remove(.recreateLocalStoreOnModelMismatch)
|
||||||
|
|
||||||
let storeOptions = storage.storeOptionsForOptions(cloudStorageOptions)
|
let storeOptions = storage.dictionary(forOptions: cloudStorageOptions)
|
||||||
do {
|
do {
|
||||||
|
|
||||||
try FileManager.default.createDirectory(
|
try FileManager.default.createDirectory(
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ public final class DataStack {
|
|||||||
/**
|
/**
|
||||||
Returns the `NSManagedObjectID` for the specified object URI if it exists in the persistent store.
|
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)
|
return self.coordinator.managedObjectID(forURIRepresentation: url)
|
||||||
}
|
}
|
||||||
@@ -237,7 +237,7 @@ public final class DataStack {
|
|||||||
var localStorageOptions = storage.localStorageOptions
|
var localStorageOptions = storage.localStorageOptions
|
||||||
localStorageOptions.remove(.recreateStoreOnModelMismatch)
|
localStorageOptions.remove(.recreateStoreOnModelMismatch)
|
||||||
|
|
||||||
let storeOptions = storage.storeOptionsForOptions(localStorageOptions)
|
let storeOptions = storage.dictionary(forOptions: localStorageOptions)
|
||||||
do {
|
do {
|
||||||
|
|
||||||
try FileManager.default.createDirectory(
|
try FileManager.default.createDirectory(
|
||||||
@@ -332,7 +332,7 @@ public final class DataStack {
|
|||||||
var cloudStorageOptions = storage.cloudStorageOptions
|
var cloudStorageOptions = storage.cloudStorageOptions
|
||||||
cloudStorageOptions.remove(.recreateLocalStoreOnModelMismatch)
|
cloudStorageOptions.remove(.recreateLocalStoreOnModelMismatch)
|
||||||
|
|
||||||
let storeOptions = storage.storeOptionsForOptions(cloudStorageOptions)
|
let storeOptions = storage.dictionary(forOptions: cloudStorageOptions)
|
||||||
do {
|
do {
|
||||||
|
|
||||||
try FileManager.default.createDirectory(
|
try FileManager.default.createDirectory(
|
||||||
@@ -515,6 +515,12 @@ public final class DataStack {
|
|||||||
|
|
||||||
return self.entityDescription(for: type)
|
return self.entityDescription(for: type)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@available(*, deprecated: 3.0.0, renamed: "objectID(forURIRepresentation:)")
|
||||||
|
public func objectIDForURIRepresentation(_ url: URL) -> NSManagedObjectID? {
|
||||||
|
|
||||||
|
return self.objectID(forURIRepresentation: url)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -400,7 +400,7 @@ public final class ICloudStore: CloudStorage {
|
|||||||
/**
|
/**
|
||||||
The options dictionary for the specified `CloudStorageOptions`
|
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 {
|
if options == .none {
|
||||||
|
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ public final class LegacySQLiteStore: LocalStorage, DefaultInitializableStore {
|
|||||||
/**
|
/**
|
||||||
The options dictionary for the specified `LocalStorageOptions`
|
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 {
|
if options == .none {
|
||||||
|
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ public final class SQLiteStore: LocalStorage, DefaultInitializableStore {
|
|||||||
/**
|
/**
|
||||||
The options dictionary for the specified `LocalStorageOptions`
|
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 {
|
if options == .none {
|
||||||
|
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ public protocol LocalStorage: StorageInterface {
|
|||||||
/**
|
/**
|
||||||
The options dictionary for the specified `LocalStorageOptions`
|
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)
|
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`
|
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)
|
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)
|
||||||
|
|||||||
Reference in New Issue
Block a user