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
Currently the ModelUpdater type is very limited, only allowing access to properties that are a Primitive.
This excludes a wide variety of property types, such as Optionals, RawRepresentables, References, or arrays of these types.
public subscript<P: Primitive>(dynamicMember keyPath:WritableKeyPath<M,QueryableField<P>>)-> P {get{self.update.model[keyPath: keyPath].value!
}set{self.update.model[keyPath: keyPath].value = newValue
letpath=M.resolveFieldPath(keyPath)self.update.changes[path]= newValue
}}
A solution could be to constrain this access to PrimitiveEncodable & Codable instead of Primitive. However, the encodePrimitive() function is potentially throwing, which is not ideal in the set accessor.
Alternatively, we could add a lot of typed overloads similar to the ModelUpdateQuery.setField functions.
The text was updated successfully, but these errors were encountered:
Currently the
ModelUpdater
type is very limited, only allowing access to properties that are aPrimitive
.This excludes a wide variety of property types, such as Optionals, RawRepresentables, References, or arrays of these types.
A solution could be to constrain this access to
PrimitiveEncodable & Codable
instead ofPrimitive
. However, theencodePrimitive()
function is potentially throwing, which is not ideal in theset
accessor.Alternatively, we could add a lot of typed overloads similar to the
ModelUpdateQuery.setField
functions.The text was updated successfully, but these errors were encountered: