Search code examples
iosobjective-crealm

Creating an uninstantiated copy of a RLMObject with all of its relationships also be uninstantiated


Say I create a RLMObject that has a relationship, which I proceed to save in my realm database. After that is complete, I decide to call initWithValues on the newly created object and return this copied object to the front end for use. I noticed that the object it has a relationship with is still considered instantiated.

Is there a way to make it such that when I call initWithValues to create an uninstantiated copy of my object, to ensure all my properties are uninstantiated as well?


Solution

  • There is no builtin way to achieve that. You would need to create a standalone copy of the object yourself. Relationships could be cyclic, so that a generic solution for that would be non-trivial.