is there an alternative to `androidx.lifecycle` in...
# multiplatform
r
is there an alternative to
androidx.lifecycle
in kmm?
m
What kind of lifecycle? Only android has a really complicated lifecycle. Desktop is basically run and go and it will always run the same no matter how much time passes or if its in focus
☝️ 1
☝🏻 1
👎 1
j
Desktop pretty much has the same lifestyle because the lifecycle maps to states of a window manager regardless of the OS. Android apps can be run in floating window mode on large display/desktops, so it only makes sense desktop applications could get the same lifecycle. Pause/resume is focused, start/stop is on visible, create/destroy is effectively the window instantiation lifecycle
👍 2
r
so this is a mobile kmm (android and iOS) and I want to use this in the shared - commonMain. so is there a way to make it work? otherwise, is there a known an alternative in iOS? then I can do
expect
and
actual
implementations
v
@Mitchell Syer having onAppMinimized/onAppInBackground would be helpful to stop some stuff / analytics
1
r
in my case I use the function for such usecases
c
you have to do an expect class for every import you're not getting in "pure" kotlin, in android will be the class import, in others you have to invent
r
yeah, looks like I’ll have to do that anyone have an idea of how to receive onStart an onPause events from iOS?
c
LaunchedEffect vs DisposableEffect
could be an idea
r
will check
thanks
c
YW
v
DisposableEffect won't do the job for minimizing the app
🥲 1