https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
r

Raed Ghazal

10/04/2023, 8:00 PM
is there an alternative to
androidx.lifecycle
in kmm?
m

Mitchell Syer

10/04/2023, 8:36 PM
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

jw

10/04/2023, 10:08 PM
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

Raed Ghazal

10/05/2023, 7:45 AM
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

Vlad

10/05/2023, 8:25 AM
@Mitchell Syer having onAppMinimized/onAppInBackground would be helpful to stop some stuff / analytics
1
r

Raed Ghazal

10/05/2023, 4:02 PM
in my case I use the function for such usecases
c

Carlo De Chellis

10/06/2023, 7:44 AM
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

Raed Ghazal

10/06/2023, 7:45 AM
yeah, looks like I’ll have to do that anyone have an idea of how to receive onStart an onPause events from iOS?
c

Carlo De Chellis

10/06/2023, 7:45 AM
LaunchedEffect vs DisposableEffect
could be an idea
r

Raed Ghazal

10/06/2023, 7:46 AM
will check
thanks
c

Carlo De Chellis

10/06/2023, 7:46 AM
YW
v

Vlad

10/06/2023, 7:49 AM
DisposableEffect won't do the job for minimizing the app
🥲 1
2 Views