Why Nostr? What is Njump?
2024-05-19 20:40:11

Christian Selig on Nostr: SwiftUI noob question: I understand why my ViewModel is being initialized twice, but ...

SwiftUI noob question: I understand why my ViewModel is being initialized twice, but why is it not being *deinitialized*?

It's created, then a second later when appState.show is changed, the view is recomputed, and view, and its ViewModel, are created anew. Cool! But why is the old one not deinitialized? What's holding onto it?

Sample code: https://gist.github.com/christianselig/d88b1a4d1989b973689ae62d4691162f

Author Public Key
npub1me4dmfx38938e68eeuz77f78e5w7nz2nv0jlxqmx0amphmp3sutq6s0ues