Hello everybody! Currently testing around in a CM...
# compose-ios
c
Hello everybody! Currently testing around in a CMP project. Im having trouble updating the state inside a swiftUI view.
Copy code
@Composable
actual fun NativeButton(
    enabled: Boolean,
    onClick: () -> Unit,
    modifier: Modifier
) {
    val factory: NativeViewFactory = LocalNativeViewFactory.current

    UIKitViewController(
        modifier = modifier,
        factory = {
            factory.createNativeButton(
                enabled = enabled,
                onClick = onClick,
            )
        }
    )
}
Changing the enabled flag is not updating the UI in SwiftUI. How do i achieve this? Any suggestions? Thanks! 🙏
r
factory is only called once. There are multiple ways of doing that, here I have 3 examples implemented: https://github.com/rschattauer/compose_multiplatform
c
Where is the definition of SwiftBridgeMapObservable and how do you instantiate it?
r
I would pick one of the other implementations as swift bridge is most likely not continued, see here: https://github.com/touchlab/compose-swift-bridge/discussions/9
c
Thanks for answers! 🙏