You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After RealmOptional was deprecated, I changed all my RealmOptional<Type> properties to RealmProperty<Type?>
I have a few places where I relied on RealmOptional being Codable. With RealmProperty also being Codable, I thought it was safe to change the property definitions. Unfortunately, while RealmOptional was able to decode null values, RealmProperty cannot:
Swift.DecodingError.valueNotFound(Swift.Optional<Swift.Double>, Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "fromKm", intValue: nil)], debugDescription: "Expected Optional<Double> but found null value instead.", underlyingError: nil))
Looking at the implementation for the two types, it is evident that RealmProperty ignores null values, while RealmOptional does not:
After RealmOptional was deprecated, I changed all my
RealmOptional<Type>
properties toRealmProperty<Type?>
I have a few places where I relied on
RealmOptional
beingCodable
. With RealmProperty also being Codable, I thought it was safe to change the property definitions. Unfortunately, whileRealmOptional
was able to decodenull
values,RealmProperty
cannot:Looking at the implementation for the two types, it is evident that
RealmProperty
ignores null values, whileRealmOptional
does not:I think this is a bug. I wonder if there is a better workaround than reverting to
RealmOptional
?Version of Realm and Tooling
Realm framework version: 10.8.0
Xcode version: 12.5.1
iOS/OSX version: 14.6
Dependency manager + version: Carthage 0.38.0
The text was updated successfully, but these errors were encountered: