Code Block swift public func add(messages inMsgs: [IncomingMessage]) { for msg in inMsgs { let msg = Message(fromIncoming: msg, user: user) self.messages.append(msg) } self.messages.sort() }
In my SwiftUI view, however, .onChanged(self.stream.messages) gets called three times each time a single message is added.
I tried operating on a local copy of self.messages, and then just setting self.messages = local, but that didn't change anything.
Maybe the issue is on the SwftUI side?
In any case, how are published updates to a property coalesced?