https://kotlinlang.org logo
#decompose
Title
# decompose
j

John O'Reilly

03/30/2024, 8:36 AM
I'm probably missing something basic but should I be able to do likes of following in common code....looks like
subscribeAsState
comes in through
com.arkivanov.decompose:extensions-compose-jetbrains
but can't use that in
commonMain
Copy code
val uiState by component.uiState.subscribeAsState()
a

Arkadii Ivanov

03/30/2024, 8:37 AM
It should be available in commonMain, assuming all targets are supported by that module. Do you have Wasm enabled?
j

John O'Reilly

03/30/2024, 8:38 AM
no....getting for iOS target it seems
Copy code
> No matching variant of com.arkivanov.decompose:extensions-compose-jetbrains:2.2.2 was found. The consumer was configured to find a library for use during 'kotlin-metadata', preferably optimized for non-jvm, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native', attribute 'org.jetbrains.kotlin.native.target' with value 'ios_arm64' but:
it works if I use in compose for desktop module directly but trying atm to move some compose code in to commonMain
a

Arkadii Ivanov

03/30/2024, 8:45 AM
Oh, for iOS you need to use -compose-experimental version for all Decompose modules. See https://arkivanov.github.io/Decompose/getting-started/installation/#support-for-compose-for-ios-and-web-jscanvas-and-wasm
j

John O'Reilly

03/30/2024, 8:49 AM
ah, nice...that worked thanks
👍 1
3 Views