Gaurav Prakash
09/20/2023, 3:39 AMPablichjenkov
09/20/2023, 3:55 AMGaurav Prakash
09/20/2023, 1:12 PMPablichjenkov
09/20/2023, 1:33 PMfun IosComponentRender(
rootComponent: Component,
iosBridge: IosBridge,
onBackPress: () -> Unit = {}
): UIViewController = ComposeUIViewController { ... }
That interface IosBridge offers 2 way communication. I send willAppear/didDisapear events to compose and receive other events/results through that interface too.Pablichjenkov
09/20/2023, 1:34 PMGaurav Prakash
09/20/2023, 1:35 PMPablichjenkov
09/20/2023, 1:38 PM@Composable
fun AndroidComponentRender(
rootComponent: Component,
androidBridge: AndroidBridge,
onBackPress: () -> Unit = {}
) { ... }
Try to check chrisbanes tivi App. I think that App manages to mix native navigation with compose.Gaurav Prakash
09/21/2023, 4:02 AMPablichjenkov
09/21/2023, 4:36 AMPablichjenkov
09/21/2023, 4:45 AM/shared/iosMain/Bindings.kt
check this file
fun IosComponentRender(
rootComponent: Component,
iosBridge: IosBridge,
onBackPress: () -> Unit = {}
): UIViewController = ComposeUIViewController {...}
You can call swift from kotlin either directly invoking a callback, see onBackPress: () -> Unit
for instance or having an EventDispatcher inside iOSBridge where listeners subscribe in the swift side and you request to dispatch the events on the kotlin side.Gaurav Prakash
09/22/2023, 2:32 PMCould not resolve io.github.pablichjenkovcomponent toolkit0.5.1.Required by: project :shared @Pablichjenkov
Pablichjenkov
09/22/2023, 2:45 PMGaurav Prakash
09/22/2023, 3:12 PMPablichjenkov
09/22/2023, 4:05 PMPablichjenkov
09/22/2023, 4:08 PM0.5.2
, if you plan to use it, let me know what needs to be added in the bridge for your use case. Or open a PR for whatever you want.Gaurav Prakash
09/22/2023, 4:27 PMGaurav Prakash
09/22/2023, 4:27 PM@OptIn(ExperimentalObjCName::class)
@ObjCName("IosComponentRender")
fun IosComponentRender(
iosBridge: IosBridge,
onBackPress: () -> Unit = {}
): UIViewController = ComposeUIViewController {
}
Gaurav Prakash
09/22/2023, 4:28 PM@OptIn(ExperimentalObjCName::class)
@ObjCName(name = "IosBridge", exact = true)
class IosBridge(
var lifecycleDispatcher: Dispatchers
)
Gaurav Prakash
09/22/2023, 4:31 PMGaurav Prakash
09/22/2023, 4:31 PMPablichjenkov
09/22/2023, 4:37 PMPablichjenkov
09/22/2023, 4:38 PM