@chris @shadowfacts @kyle echoing the above, I think this is made more explicit if you use the State init, like _vm = State(initialValue: …)
This makes it more obvious why the initial example was broken and avoids a new vm on every init (but you still need your onchange)
@shadowfacts @chris @kyle woof -- here's to hoping there's some magical new tool that eliminates all this confusion.
IME it’s far too easy to just not realize you're accidentally recreating state 60 times/sec because you modeled it incorrectly.
@shadowfacts @kyle I updated the article to show a variant that doesn't always recreate the VM. It's tricky.
BTW, @shadowfacts I really enjoyed reading your article about preferences!