Synced Realm SwiftUI typing freeze

I’ve been running into an issue on realm-swift 10.25.0 where editing a field with the bindings such as:

@ObservedRealmObject var address: Address

TextField("City", text: $address.city)

If I type too fast (meaning, still slower than regular speed) the whole app freezes with an error like this:

Binding action tried to update multiple times per frame.

I’m currently moving toward storing strings in state variables and updating Realm objects on completion just to get around it, but wondering if anyone else is seeing this happen or if there is a way to make sure that it doesn’t happen?

1 Like

I’ve seen this happen, too, @Kurt_Libby1 , but haven’t been able to reproduce with consistency, so I (perhaps naively) assumed I was doing something wrong. I did the same workaround - stored the strings in state variables to sidestep the issue. I’ll flag this with the SDK team and see if they have any info around this.

2 Likes

Following up, a member of the Swift SDK team recommends debounce to reduce the update frequency, @Kurt_Libby1 . We don’t currently have anything in our docs or example projects showing this, so I don’t have anything to point you at to show you how best to implement this. I’m making a ticket to provide some docs/code guidance around this, though. Meanwhile, if you try this in your project and it resolves your issue, I’d love to hear about it.