Jan
05/12/2023, 8:59 AMsubscribeAsState
:
interface IRootComponent {
val dialogSlot: Value<ChildSlot<*, DialogComponent>>
}
My RootContent:
@Composable
fun RootContent(component: RootComponent, modifier: Modifier = Modifier) {
val dialogSlot by component.dialogSlot.subscribeAsState()
dialogSlot.child?.instance?.also {
DialogContent(dialogComponent = it)
}
}
and then I get a compilation error saying:
Type 'State<ChildSlot<*, DialogComponent>>' has no method 'getValue(Nothing?, KProperty<*>)' and thus it cannot serve as a delegate
Arkadii Ivanov
05/12/2023, 9:15 AMJan
05/12/2023, 9:20 AMArkadii Ivanov
05/12/2023, 9:21 AMJan
05/12/2023, 9:22 AMimport com.arkivanov.decompose.extensions.compose.jetbrains.subscribeAsState
insteadArkadii Ivanov
05/12/2023, 9:27 AMState
, so State#getValue
extension function has to be imported in order for by
delegation to work.Jan
05/12/2023, 9:33 AMArkadii Ivanov
05/12/2023, 9:35 AMJan
05/12/2023, 9:35 AMArkadii Ivanov
05/12/2023, 10:13 AMJan
05/12/2023, 10:34 AMArkadii Ivanov
05/12/2023, 10:57 AMJan
05/12/2023, 10:57 AMArkadii Ivanov
05/12/2023, 5:46 PMJan
05/15/2023, 8:46 AMCaused by: java.lang.IllegalStateException: Executing of 'xcodebuild -project Pods.xcodeproj -scheme Base64 -sdk iphoneos -configuration Release' failed with code 65 and message:
import com.arkivanov.decompose.extensions.compose.jetbrains.subscribeAsState
Afterwards AS asks for the import:
import androidx.compose.runtime.getValue
This also works in my other projectArkadii Ivanov
05/15/2023, 9:47 AMJan
05/15/2023, 9:52 AM