Why @Published var didSet is called extra time when it's referenced by TextField/binding?

i see. in this case another workaround is possible when you make the "same" value different:

struct VersionedInt: Equatable {
    var version: Int = nextVersion() // does some counter++
    let value: Int
}

but indeed this becomes too messy too quick.

there's a valid question what do you do with your animation if there are several real changes in a quick succession. the reasonable thing to do would be to stop the current animation and start the new one. in principle this approach shall handle the situation with those spurious value changes.

1 Like