vendredi 21 juillet 2023

Setting Realm Object property / relation dynamically

I am using realm in a react native project in typescript, and I would like to assign a relation object to another object dynamically.

For instance, instead of doing myUserObject.profile = myProfileObject I would like to do something like that : myUserObjectTypedAsRealmObject[relationName] = theOtherRealmObject.

Is it possible to make something dynamic like that ? I also tried to change type of relationName from string to keyof Realm.Object but that also didn't work.





Aucun commentaire:

Enregistrer un commentaire