I have a viewModel, into which is passed an arbitrary number of Realm objects.
These objects look something like this:
rootObject
|__ EmbeddedObjectA
----|___propertyB
...and more similar
The viewModel holds several computed properties that are based on EmbeddedObjectA
and propertyB
.
The problem is that those computed properties never update because the embedded objects and its properties are not properly observed. I have tried countless things that all haven’t worked and this seems far more complex than it should be.
I know that it is actually writing the changes correctly because if I close the associated view and re-open it the values are correct since the rootObject set is reloaded.
My questions:
- What should I be passing the set of rootObjects into the viewModel as?
– I’ve triedSet< rootObject>
,@ObservedRealmObject RealmSwift.List<rootObject>
, and probably several I’m forgetting. - How do I actually observe
propertyB
?!
– I’ve triedEmbeddedPropertyA.observe
,objectWillChange.send()
in countless configurations. - Why does this seem like a recurring thing in Mongo/Realm? I’ve seen this question countless times across the internet (none with a working solution) so why is it such a pervasive thing?!
Thank you in advance for your help!