- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 110
 
Open
Labels
Description
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
            let path = 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.