mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-03-20 08:33:53 +01:00
minor Swift 3 cleanup
This commit is contained in:
@@ -216,6 +216,17 @@ public struct MigrationChain: ExpressibleByNilLiteral, ExpressibleByStringLitera
|
||||
}
|
||||
|
||||
|
||||
// MARK: Equatable
|
||||
|
||||
public static func == (lhs: MigrationChain, rhs: MigrationChain) -> Bool {
|
||||
|
||||
return lhs.versionTree == rhs.versionTree
|
||||
&& lhs.rootVersions == rhs.rootVersions
|
||||
&& lhs.leafVersions == rhs.leafVersions
|
||||
&& lhs.valid == rhs.valid
|
||||
}
|
||||
|
||||
|
||||
// MARK: Internal
|
||||
|
||||
internal let rootVersions: Set<String>
|
||||
@@ -249,14 +260,3 @@ public struct MigrationChain: ExpressibleByNilLiteral, ExpressibleByStringLitera
|
||||
fileprivate let versionTree: [String: String]
|
||||
}
|
||||
|
||||
|
||||
// MARK: - MigrationChain: Equatable
|
||||
|
||||
public func == (lhs: MigrationChain, rhs: MigrationChain) -> Bool {
|
||||
|
||||
return lhs.versionTree == rhs.versionTree
|
||||
&& lhs.rootVersions == rhs.rootVersions
|
||||
&& lhs.leafVersions == rhs.leafVersions
|
||||
&& lhs.valid == rhs.valid
|
||||
}
|
||||
|
||||
|
||||
@@ -83,6 +83,24 @@ public enum MigrationResult: Hashable {
|
||||
}
|
||||
|
||||
|
||||
// MARK: Equatable
|
||||
|
||||
public static func == (lhs: MigrationResult, rhs: MigrationResult) -> Bool {
|
||||
|
||||
switch (lhs, rhs) {
|
||||
|
||||
case (.success(let migrationTypes1), .success(let migrationTypes2)):
|
||||
return migrationTypes1 == migrationTypes2
|
||||
|
||||
case (.failure(let error1), .failure(let error2)):
|
||||
return error1 == error2
|
||||
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: Hashable
|
||||
|
||||
public var hashValue: Int {
|
||||
@@ -116,21 +134,3 @@ public enum MigrationResult: Hashable {
|
||||
self = .failure(CoreStoreError(error))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - SetupResult: Equatable
|
||||
|
||||
public func == (lhs: MigrationResult, rhs: MigrationResult) -> Bool {
|
||||
|
||||
switch (lhs, rhs) {
|
||||
|
||||
case (.success(let migrationTypes1), .success(let migrationTypes2)):
|
||||
return migrationTypes1 == migrationTypes2
|
||||
|
||||
case (.failure(let error1), .failure(let error2)):
|
||||
return error1 == error2
|
||||
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,6 +122,27 @@ public enum MigrationType: Hashable {
|
||||
}
|
||||
|
||||
|
||||
// MARK: Equatable
|
||||
|
||||
public static func == (lhs: MigrationType, rhs: MigrationType) -> Bool {
|
||||
|
||||
switch (lhs, rhs) {
|
||||
|
||||
case (.none(let version1), .none(let version2)):
|
||||
return version1 == version2
|
||||
|
||||
case (.lightweight(let source1, let destination1), .lightweight(let source2, let destination2)):
|
||||
return source1 == source2 && destination1 == destination2
|
||||
|
||||
case (.heavyweight(let source1, let destination1), .heavyweight(let source2, let destination2)):
|
||||
return source1 == source2 && destination1 == destination2
|
||||
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: Hashable
|
||||
|
||||
public var hashValue: Int {
|
||||
@@ -140,24 +161,3 @@ public enum MigrationType: Hashable {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - MigrationType: Equatable
|
||||
|
||||
public func == (lhs: MigrationType, rhs: MigrationType) -> Bool {
|
||||
|
||||
switch (lhs, rhs) {
|
||||
|
||||
case (.none(let version1), .none(let version2)):
|
||||
return version1 == version2
|
||||
|
||||
case (.lightweight(let source1, let destination1), .lightweight(let source2, let destination2)):
|
||||
return source1 == source2 && destination1 == destination2
|
||||
|
||||
case (.heavyweight(let source1, let destination1), .heavyweight(let source2, let destination2)):
|
||||
return source1 == source2 && destination1 == destination2
|
||||
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,6 +86,24 @@ public enum SetupResult<T: StorageInterface>: Hashable {
|
||||
}
|
||||
|
||||
|
||||
// MARK: Equatable
|
||||
|
||||
public static func == <T: StorageInterface, U: StorageInterface>(lhs: SetupResult<T>, rhs: SetupResult<U>) -> Bool {
|
||||
|
||||
switch (lhs, rhs) {
|
||||
|
||||
case (.success(let storage1), .success(let storage2)):
|
||||
return storage1 === storage2
|
||||
|
||||
case (.failure(let error1), .failure(let error2)):
|
||||
return error1 == error2
|
||||
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: Hashable
|
||||
|
||||
public var hashValue: Int {
|
||||
@@ -118,21 +136,3 @@ public enum SetupResult<T: StorageInterface>: Hashable {
|
||||
self = .failure(CoreStoreError(error))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - SetupResult: Equatable
|
||||
|
||||
public func == <T: StorageInterface, U: StorageInterface>(lhs: SetupResult<T>, rhs: SetupResult<U>) -> Bool {
|
||||
|
||||
switch (lhs, rhs) {
|
||||
|
||||
case (.success(let storage1), .success(let storage2)):
|
||||
return storage1 === storage2
|
||||
|
||||
case (.failure(let error1), .failure(let error2)):
|
||||
return error1 == error2
|
||||
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user