Roddy :swift: on Nostr: npub1sy8vt…pw2zc Essentially a child View not updating when a property from its ...
npub1sy8vt0hed8vr58ueqjlvmpzylv9he2fvv04luf4z5vyzsuut5zvqfpw2zc (npub1sy8…w2zc) Essentially a child View not updating when a property from its parent changes.
We're following a strict MVVM approach (where each View has its own StateObject, that is initialised in the View's init with its dependent arguments). Of course, if those arguments change, the StateObject isn't recreated, so the View doesn't change
Solution was to also set those dependencies on the View, and add an .onChange modifier that will then call a ViewModel method to update the @Published property
We're following a strict MVVM approach (where each View has its own StateObject, that is initialised in the View's init with its dependent arguments). Of course, if those arguments change, the StateObject isn't recreated, so the View doesn't change
Solution was to also set those dependencies on the View, and add an .onChange modifier that will then call a ViewModel method to update the @Published property