WIP: demo app

This commit is contained in:
John Rommel Estropia
2016-07-25 08:21:22 +09:00
parent db5b8ca702
commit e9be711d4c
61 changed files with 210 additions and 298 deletions

View File

@@ -47,7 +47,6 @@ public extension CoreStore {
}
)
```
- parameter storeType: the storage type
- parameter completion: the closure to be executed on the main queue when the process completes, either due to success or failure. The closure's `SetupResult` argument indicates the result. Note that the `StorageInterface` associated to the `SetupResult.success` may not always be the same instance as the parameter argument if a previous `StorageInterface` was already added at the same URL and with the same configuration.
*/
@@ -69,7 +68,6 @@ public extension CoreStore {
}
)
```
- parameter storage: the storage
- parameter completion: the closure to be executed on the main queue when the process completes, either due to success or failure. The closure's `SetupResult` argument indicates the result. Note that the `StorageInterface` associated to the `SetupResult.success` may not always be the same instance as the parameter argument if a previous `StorageInterface` was already added at the same URL and with the same configuration.
*/
@@ -91,7 +89,6 @@ public extension CoreStore {
}
)
```
- parameter storeType: the local storage type
- parameter completion: the closure to be executed on the main queue when the process completes, either due to success or failure. The closure's `SetupResult` argument indicates the result. Note that the `LocalStorage` associated to the `SetupResult.success` may not always be the same instance as the parameter argument if a previous `LocalStorage` was already added at the same URL and with the same configuration.
- returns: an `NSProgress` instance if a migration has started, or `nil` if either no migrations are required or if a failure occured.
@@ -114,7 +111,6 @@ public extension CoreStore {
}
)
```
- parameter storage: the local storage
- parameter completion: the closure to be executed on the main queue when the process completes, either due to success or failure. The closure's `SetupResult` argument indicates the result. Note that the `LocalStorage` associated to the `SetupResult.success` may not always be the same instance as the parameter argument if a previous `LocalStorage` was already added at the same URL and with the same configuration.
- returns: an `NSProgress` instance if a migration has started, or `nil` if either no migrations are required or if a failure occured.
@@ -148,7 +144,6 @@ public extension CoreStore {
}
)
```
- parameter storage: the cloud storage
- parameter completion: the closure to be executed on the main queue when the process completes, either due to success or failure. The closure's `SetupResult` argument indicates the result. Note that the `CloudStorage` associated to the `SetupResult.success` may not always be the same instance as the parameter argument if a previous `CloudStorage` was already added at the same URL and with the same configuration.
*/

View File

@@ -47,7 +47,6 @@ public extension DataStack {
}
)
```
- parameter storeType: the storage type
- parameter completion: the closure to be executed on the main queue when the process completes, either due to success or failure. The closure's `SetupResult` argument indicates the result. Note that the `StorageInterface` associated to the `SetupResult.success` may not always be the same instance as the parameter argument if a previous `StorageInterface` was already added at the same URL and with the same configuration.
*/
@@ -69,7 +68,6 @@ public extension DataStack {
}
)
```
- parameter storage: the storage
- parameter completion: the closure to be executed on the main queue when the process completes, either due to success or failure. The closure's `SetupResult` argument indicates the result. Note that the `StorageInterface` associated to the `SetupResult.success` may not always be the same instance as the parameter argument if a previous `StorageInterface` was already added at the same URL and with the same configuration.
*/
@@ -127,7 +125,6 @@ public extension DataStack {
}
)
```
- parameter storeType: the local storage type
- parameter completion: the closure to be executed on the main queue when the process completes, either due to success or failure. The closure's `SetupResult` argument indicates the result. Note that the `LocalStorage` associated to the `SetupResult.success` may not always be the same instance as the parameter argument if a previous `LocalStorage` was already added at the same URL and with the same configuration.
- returns: an `NSProgress` instance if a migration has started, or `nil` if either no migrations are required or if a failure occured.
@@ -150,7 +147,6 @@ public extension DataStack {
}
)
```
- parameter storage: the local storage
- parameter completion: the closure to be executed on the main queue when the process completes, either due to success or failure. The closure's `SetupResult` argument indicates the result. Note that the `LocalStorage` associated to the `SetupResult.success` may not always be the same instance as the parameter argument if a previous `LocalStorage` was already added at the same URL and with the same configuration.
- returns: an `NSProgress` instance if a migration has started, or `nil` if either no migrations are required or if a failure occured.
@@ -176,8 +172,8 @@ public extension DataStack {
if let persistentStore = self.coordinator.persistentStore(for: fileURL as URL) {
if let existingStorage = persistentStore.storageInterface as? T
where storage.matchesPersistentStore(persistentStore) {
if let existingStorage = persistentStore.storageInterface as? T,
storage.matchesPersistentStore(persistentStore) {
GCDQueue.main.async {
@@ -316,7 +312,6 @@ public extension DataStack {
}
)
```
- parameter storage: the cloud storage
- parameter completion: the closure to be executed on the main queue when the process completes, either due to success or failure. The closure's `SetupResult` argument indicates the result. Note that the `CloudStorage` associated to the `SetupResult.success` may not always be the same instance as the parameter argument if a previous `CloudStorage` was already added at the same URL and with the same configuration.
*/
@@ -336,8 +331,8 @@ public extension DataStack {
if let persistentStore = self.coordinator.persistentStore(for: cacheFileURL as URL) {
if let existingStorage = persistentStore.storageInterface as? T
where storage.matchesPersistentStore(persistentStore) {
if let existingStorage = persistentStore.storageInterface as? T,
storage.matchesPersistentStore(persistentStore) {
GCDQueue.main.async {
@@ -608,7 +603,7 @@ public extension DataStack {
operations.append(
BlockOperation { [weak self] in
guard let `self` = self where !cancelled else {
guard let `self` = self, !cancelled else {
return
}
@@ -684,7 +679,8 @@ public extension DataStack {
while let nextVersion = migrationChain.nextVersionFrom(currentVersion),
let sourceModel = model[currentVersion],
let destinationModel = model[nextVersion] where sourceModel != model {
sourceModel != model,
let destinationModel = model[nextVersion] {
if let mappingModel = NSMappingModel(
from: storage.mappingModelBundles,

View File

@@ -138,7 +138,7 @@ public struct MigrationChain: NilLiteralConvertible, StringLiteralConvertible, D
var checklist: Set<String> = [start]
var version = start
while let nextVersion = versionTree[version] where nextVersion != version {
while let nextVersion = versionTree[version], nextVersion != version {
if checklist.contains(nextVersion) {
@@ -236,7 +236,7 @@ public struct MigrationChain: NilLiteralConvertible, StringLiteralConvertible, D
internal func nextVersionFrom(_ version: String) -> String? {
guard let nextVersion = self.versionTree[version] where nextVersion != version else {
guard let nextVersion = self.versionTree[version], nextVersion != version else {
return nil
}
@@ -252,7 +252,6 @@ public struct MigrationChain: NilLiteralConvertible, StringLiteralConvertible, D
// MARK: - MigrationChain: Equatable
@warn_unused_result
public func == (lhs: MigrationChain, rhs: MigrationChain) -> Bool {
return lhs.versionTree == rhs.versionTree

View File

@@ -135,48 +135,3 @@ public func == <T: StorageInterface, U: StorageInterface>(lhs: SetupResult<T>, r
return false
}
}
// MARK: - Deprecated
/**
Deprecated. Replaced by `SetupResult<T>` when using the new `addStorage(_:completion:)` method variants.
*/
@available(*, deprecated: 2.0.0, message: "Replaced by SetupResult by using the new addStorage(_:completion:) method variants.")
public enum PersistentStoreResult: Boolean {
/**
Deprecated. Replaced by `SetupResult.success` when using the new `addStorage(_:completion:)` method variants.
*/
case success(NSPersistentStore)
/**
Deprecated. Replaced by `SetupResult.failure` when using the new `addStorage(_:completion:)` method variants.
*/
case failure(NSError)
// MARK: BooleanType
public var boolValue: Bool {
switch self {
case .success: return true
case .failure: return false
}
}
// MARK: Internal
internal init(_ store: NSPersistentStore) {
self = .success(store)
}
internal init(_ error: NSError) {
self = .failure(error)
}
}