Hi, I'm building a browser-like app, where the use...
# getting-started
s
Hi, I'm building a browser-like app, where the user could create multiple tabs, each of which manages its own state. The way I've done this for now is by having a
TabViewModel
for each individual tab, and then have a
List<TabViewModel>
managed by a
MainViewModel
which manages their creation, removal, and switching. Is this a good approach to doing things? Consuming each tab's state from UI is a bit clunky, and I'm unsure about proper lifecycle management here (esp. for
TabViewModels
that are essentially created and stored by the
MainViewModel
(just using the constructor)), but I'd love to know if there's a better way of doing this.
d
I suspect #C0B8M7BUY is a better place to ask such questions.
s
I'm building a KMP app, this is probably more about general architecture than it is Android ViewModel specifics (although I agree, I use AAC ViewModels (KMP) so there's certainly a relationship to Android, esp. around lifecycles etc...).