WIP: Renaming to meet Swift 3 API guidelines

This commit is contained in:
John Estropia
2016-09-09 18:30:08 +09:00
parent e5245a0e5b
commit a51ed1a007
7 changed files with 17 additions and 11 deletions

View File

@@ -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`.

View File

@@ -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(

View File

@@ -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)
}
}

View File

@@ -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 {

View File

@@ -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 {

View File

@@ -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 {

View File

@@ -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)