Skip to content

Commit b91ae75

Browse files
committed
Add default conformance for unamangeId error description when UnmanagedId conforms to CustomStringConvertible
fix-incorrect-error-descriptions
1 parent 20f7c84 commit b91ae75

3 files changed

Lines changed: 6 additions & 8 deletions

File tree

Sources/CoreDataRepository/IdentifiedUnmanagedModel.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,9 @@ extension IdentifiedUnmanagedModel {
4545
return managed
4646
}
4747
}
48+
49+
extension IdentifiedUnmanagedModel where UnmanagedId: CustomStringConvertible {
50+
public static func errorDescription(for unmanagedId: UnmanagedId) -> String {
51+
unmanagedId.description
52+
}
53+
}

Sources/Internal/ModelsWithIntId/IdentifiableModel_Int.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,6 @@ extension IdentifiableModel_IntId: IdentifiedUnmanagedModel {
105105
}
106106

107107
package nonisolated(unsafe) static let unmanagedIdExpression = NSExpression(forKeyPath: \ManagedModel_IntId.id)
108-
109-
package static func errorDescription(for unmanagedId: Int) -> String {
110-
unmanagedId.description
111-
}
112108
}
113109

114110
extension IdentifiableModel_IntId: WritableUnmanagedModel {

Sources/Internal/ModelsWithUuidId/IdentifiableModel_Uuid.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,6 @@ extension IdentifiableModel_UuidId: IdentifiedUnmanagedModel {
105105
}
106106

107107
package nonisolated(unsafe) static let unmanagedIdExpression = NSExpression(forKeyPath: \ManagedModel_UuidId.id)
108-
109-
package static func errorDescription(for unmanagedId: UUID) -> String {
110-
unmanagedId.uuidString
111-
}
112108
}
113109

114110
extension IdentifiableModel_UuidId: WritableUnmanagedModel {

0 commit comments

Comments
 (0)