https://kotlinlang.org logo
#compose
Title
# compose
i

iamthevoid

07/05/2021, 12:29 PM
Is there some kind
onDestroyView
for composable? For example here listed example when viewModel value assigning as default parameter in composable function by
viewModel()
call. If i understand correct this factory creates (or returns) view model from activity or fragment scope. But what if i develop single activity app with huge number of features on billions screens? Should i use activity view model scope or i must include fragments to my code or there is better way to handle memory in compose?
i want any composable-related scope that will be destroyed after view goes out from stack
d

Daniel

07/05/2021, 12:40 PM
You can scope viewmodels to navigation destinations which are composables instead of fragments
i

iamthevoid

07/05/2021, 12:50 PM
Checked that.
onCleared
calls when composable goes out from screen, it is perfect!
👍 1
Thanks
d

Daniel

07/08/2021, 7:00 AM
cool
20 Views