diff --git a/Sources/CoreStore+CustomDebugStringConvertible.swift b/Sources/CoreStore+CustomDebugStringConvertible.swift index ca39d52..db99e03 100644 --- a/Sources/CoreStore+CustomDebugStringConvertible.swift +++ b/Sources/CoreStore+CustomDebugStringConvertible.swift @@ -1093,15 +1093,6 @@ fileprivate extension String { return String(repeating: " ", count: level * 4) } - fileprivate func trimSwiftModuleName() -> String { - - if self.hasPrefix("Swift.") { - - return self.substring(from: "Swift.".endIndex) - } - return self - } - fileprivate mutating func indent(_ level: Int) { self = self.replacingOccurrences(of: "\n", with: "\n\(String.indention(level))") diff --git a/Sources/CoreStoreSchema.swift b/Sources/CoreStoreSchema.swift index fdb78c2..0568b9e 100644 --- a/Sources/CoreStoreSchema.swift +++ b/Sources/CoreStoreSchema.swift @@ -538,7 +538,7 @@ public final class CoreStoreSchema: DynamicSchema { } else { - let newMethod = class_getClassMethod(managedObjectClass, newSelector) + let newMethod = class_getClassMethod(managedObjectClass, newSelector)! method_exchangeImplementations(origMethod, newMethod) } } diff --git a/Sources/XcodeDataModelSchema.swift b/Sources/XcodeDataModelSchema.swift index e4db7ff..19a9819 100644 --- a/Sources/XcodeDataModelSchema.swift +++ b/Sources/XcodeDataModelSchema.swift @@ -145,7 +145,7 @@ public final class XcodeDataModelSchema: DynamicSchema { public required init(modelName: ModelVersion, modelVersionFileURL: URL) { CoreStore.assert( - NSManagedObjectModel(contentsOf: modelVersionFileURL) != nil, + FileManager.default.fileExists(atPath: modelVersionFileURL.path), "Could not find the \"\(modelName).mom\" version file for the model at URL \"\(modelVersionFileURL)\"." ) @@ -164,12 +164,13 @@ public final class XcodeDataModelSchema: DynamicSchema { return cachedRawModel } - if let rawModel = NSManagedObjectModel(contentsOf: self.modelVersionFileURL) { - - self.cachedRawModel = rawModel - return rawModel - } - CoreStore.abort("Could not create an \(cs_typeName(NSManagedObjectModel.self)) from the model at URL \"\(self.modelVersionFileURL)\".") + CoreStore.assert( + FileManager.default.fileExists(atPath: self.modelVersionFileURL.path), + "Could not find the \"\(self.modelVersion).mom\" version file for the model at URL \"\(self.modelVersionFileURL)\"." + ) + let rawModel = NSManagedObjectModel(contentsOf: self.modelVersionFileURL) + self.cachedRawModel = rawModel + return rawModel }