Update realm object without triggering

Hey guys,

is there any way to update realm objects without triggering a rerender? Cause I have to change some ids of my objects once I get them from the API, but I don’t want the writes to cause a rerender (because it will result in e.g. my image-flipper to jump back to index 0 etc.)

Or maybe another approach for issues like this?

Thanks in advance!

The question is a bit vague; what is a ‘rerender’ and what’s the use case causing it?

Realm is not directly related to any UI element ‘rendering’ so perhaps you could supply a very brief piece of code we can use to duplicate the issue? Are you using observers or perhaps SwiftUI wrappers?

Oh, and yes you can silently write to Realm without causing an event. See Silent Write

Yea I’m using SwiftUI wrappers for a collection, so any change to that collection triggers the view to render again and set back to its initial state (leaving out a bit of stuff in between for complexity’s sake).

After reading up a bit I guess I should use an observer instead with e.g. a keyPath, and then pass the notificationToken to the actual write (even though that would at least need a new EnvironmentObject to not make it messy)

Bottom line, I have a spot in my code where I want to write changes to a realm object, without the SwiftUI wrapper detecting a change and forcing new renders / calculations and throwing off the current state.