mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-02-24 16:45:07 +01:00
WIP: pretty logging
This commit is contained in:
@@ -845,27 +845,20 @@ public extension DataStack {
|
||||
@available(*, deprecated=2.0.0, message="Use addStorage(_:completion:) by passing a InMemoryStore instance.")
|
||||
public func addInMemoryStore(configuration configuration: String? = nil, completion: (PersistentStoreResult) -> Void) {
|
||||
|
||||
do {
|
||||
|
||||
try self.addStorage(
|
||||
InMemoryStore(configuration: configuration),
|
||||
completion: { result in
|
||||
self.addStorage(
|
||||
InMemoryStore(configuration: configuration),
|
||||
completion: { result in
|
||||
|
||||
switch result {
|
||||
|
||||
switch result {
|
||||
|
||||
case .Success(let storage):
|
||||
completion(PersistentStoreResult(self.persistentStoreForStorage(storage)!))
|
||||
|
||||
case .Failure(let error):
|
||||
completion(PersistentStoreResult(error as NSError))
|
||||
}
|
||||
case .Success(let storage):
|
||||
completion(PersistentStoreResult(self.persistentStoreForStorage(storage)!))
|
||||
|
||||
case .Failure(let error):
|
||||
completion(PersistentStoreResult(error as NSError))
|
||||
}
|
||||
)
|
||||
}
|
||||
catch {
|
||||
|
||||
completion(PersistentStoreResult(error as NSError))
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -876,7 +869,7 @@ public extension DataStack {
|
||||
@available(*, deprecated=2.0.0, message="Use addStorage(_:completion:) by passing a LegacySQLiteStore instance. Warning: The default SQLite file location for the LegacySQLiteStore and SQLiteStore are different. If the app was using this method prior to 2.0.0, make sure to use LegacySQLiteStore.")
|
||||
public func addSQLiteStore(fileName fileName: String, configuration: String? = nil, mappingModelBundles: [NSBundle]? = nil, resetStoreOnModelMismatch: Bool = false, completion: (PersistentStoreResult) -> Void) throws -> NSProgress? {
|
||||
|
||||
return try self.addStorage(
|
||||
return self.addStorage(
|
||||
LegacySQLiteStore(
|
||||
fileName: fileName,
|
||||
configuration: configuration,
|
||||
@@ -905,7 +898,7 @@ public extension DataStack {
|
||||
@available(*, deprecated=2.0.0, message="Use addSQLiteStore(_:completion:) by passing a LegacySQLiteStore instance. Warning: The default SQLite file location for the LegacySQLiteStore and SQLiteStore are different. If the app was using this method prior to 2.0.0, make sure to use LegacySQLiteStore.")
|
||||
public func addSQLiteStore(fileURL fileURL: NSURL = LegacySQLiteStore.defaultFileURL, configuration: String? = nil, mappingModelBundles: [NSBundle]? = NSBundle.allBundles(), resetStoreOnModelMismatch: Bool = false, completion: (PersistentStoreResult) -> Void) throws -> NSProgress? {
|
||||
|
||||
return try self.addStorage(
|
||||
return self.addStorage(
|
||||
LegacySQLiteStore(
|
||||
fileURL: fileURL,
|
||||
configuration: configuration,
|
||||
|
||||
@@ -248,31 +248,3 @@ public struct MigrationChain: NilLiteralConvertible, StringLiteralConvertible, D
|
||||
|
||||
private let versionTree: [String: String]
|
||||
}
|
||||
|
||||
|
||||
// MARK: - MigrationChain: CustomDebugStringConvertible
|
||||
|
||||
extension MigrationChain: CustomDebugStringConvertible {
|
||||
|
||||
public var debugDescription: String {
|
||||
|
||||
guard self.valid else {
|
||||
|
||||
return "<invalid migration chain>"
|
||||
}
|
||||
|
||||
var paths = [String]()
|
||||
for var version in self.rootVersions {
|
||||
|
||||
var steps = [version]
|
||||
while let nextVersion = self.nextVersionFrom(version) {
|
||||
|
||||
steps.append(nextVersion)
|
||||
version = nextVersion
|
||||
}
|
||||
paths.append(steps.joinWithSeparator(" → "))
|
||||
}
|
||||
|
||||
return "[" + paths.joinWithSeparator("], [") + "]"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user