https://kotlinlang.org logo
#compose-ios
Title
# compose-ios
d

Djuro

03/02/2024, 5:22 PM
Hi everyone, hope you are all doing well 👋 Is there some workaround to
collectAsStateWithLifecycle
in iOS? I know I can use `expect`/`actual` to use
collectAsState
in iOS and
collectAsStateWithLifecycle
in Android but I was wondering if there is some manual workaround to have collectAsStateWithLifecycle on iOS or it just works differently on that platform?
a

Arkadii Ivanov

03/02/2024, 10:25 PM
I think it depends on what you are using for lifecycle in KMP. If you are using Decompose/Essenty Lifecycle, maybe
Flow.withLifecycle
will work for you?
thank you color 1
l

louiscad

03/04/2024, 4:16 PM
androidx.lifecycle is now multiplatform (since last week), but I'm not sure if
collectAsStateWithLifecycle
already is since it's very recent.
thank you color 1
d

Djuro

03/04/2024, 7:18 PM
Thank you guys, I will wait for it to be ready then. Wont overcomplicate things since app is still in its early phase
c

Carlos Manuel Peguero Gomez

03/07/2024, 1:37 PM
@Djuro you can take a look at
PreCompose
library here are some specs: • Navigation • ViewModel • Lifecycle handler including
collectAsStateWithLifecycle
.
d

Djuro

03/07/2024, 1:48 PM
Thank you Carlos but I will stick to decompose since I think it is much better
1
decompose intensifies 1
10 Views