airbnb / mavericks

Mavericks: Android on Autopilot
https://airbnb.io/mavericks/
Apache License 2.0
5.83k stars 500 forks source link

I am using MavericksViewModel on Compose, I want to get the LifecycleOwner object in ViewModel how do I need to get this? #706

Closed artillerymans closed 8 months ago

gpeal commented 9 months ago

What are you trying to do? A ViewModel has a different lifecycle from a Composable and, as a result, a ViewModel shouldn't know or care about any lifecycles other than its own.

artillerymans commented 9 months ago

Because many third-party libraries use LifecycleOwner to manage the lifecycle.

gpeal commented 9 months ago

Right, but your ViewModel shouldn't be consuming or need to know about other lifecycles