File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Sources/ManagedModels/SchemaCompatibility Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -66,7 +66,10 @@ final class CodableBox<T: Codable>: NSObject, NSCopying {
66
66
67
67
override func transformedValue( _ value: Any ? ) -> Any ? {
68
68
// value is the box
69
- guard let value else { return nil }
69
+ guard var value else { return nil }
70
+ if let baseTyped = value as? T {
71
+ value = CodableBox < T > ( baseTyped)
72
+ }
70
73
guard let typed = value as? CodableBox < T > else {
71
74
assertionFailure ( " Value to be transformed is not the box? \( value) " )
72
75
return nil
@@ -77,7 +80,7 @@ final class CodableBox<T: Codable>: NSObject, NSCopying {
77
80
override func reverseTransformedValue( _ value: Any ? ) -> Any ? {
78
81
guard let value else { return nil }
79
82
guard let data = value as? Data else { return nil }
80
- return CodableBox < T > ( data: data)
83
+ return CodableBox < T > ( data: data) ? . value
81
84
}
82
85
}
83
86
}
You can’t perform that action at this time.
0 commit comments