WIP: SaveResult bridge

This commit is contained in:
John Rommel Estropia committed 2016-03-25 07:57:09 +09:00
1 parent 90369cf994
commit 707445a169
11 files changed
+189 -59

No files matched your search

+26 -1
View File
@@ -29,7 +29,7 @@ import CoreData
// MARK: - CoreStoreError
public enum CoreStoreError: ErrorType, CustomStringConvertible, CustomDebugStringConvertible, Equatable {
public enum CoreStoreError: ErrorType, CustomStringConvertible, CustomDebugStringConvertible, Hashable {
/**
A failure occured because of an unknown error.
@@ -94,6 +94,31 @@ public enum CoreStoreError: ErrorType, CustomStringConvertible, CustomDebugStrin
}
// MARK: Hashable
public var hashValue: Int {
let code = self._code
switch self {
case .Unknown:
return code.hashValue
case .DifferentStorageExistsAtURL(let existingPersistentStoreURL):
return code.hashValue ^ existingPersistentStoreURL.hashValue
case .MappingModelNotFound(let localStoreURL, let targetModel, let targetModelVersion):
return code.hashValue ^ localStoreURL.hashValue ^ targetModel.hashValue ^ targetModelVersion.hashValue
case .ProgressiveMigrationRequired(let localStoreURL):
return code.hashValue ^ localStoreURL.hashValue
case .InternalError(let NSError):
return code.hashValue ^ NSError.hashValue
}
}
// MARK: Internal
internal init(_ error: ErrorType?) {