What is Nostr?
Roddy :swift: /
npub1wh4…qdh2
2023-08-13 15:39:54
in reply to nevent1q…nqyn

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
Author Public Key
npub1wh4zj0q2s0djckdzz7tgrylyt05wngu3v90r4hvl7zzptm2d7t6sjtqdh2