Vladimir Malykhin
07/24/2023, 12:34 PMactual class Platform actual constructor() {
actual val platform: String = UIDevice.currentDevice.systemName() + " " + UIDevice.currentDevice.systemVersion
public fun UserInfoViewController() = ComposeUIViewController { Profile() }
}
in iOS project when navigate to viewController
let view = Platform().UserInfoViewController()
But in does not work - I see empty screen but compose code in android work correctly. What else need to add that screen correctly show?Dima Avdeev
07/24/2023, 3:32 PM// some standart iOS logic to initialize Application and window:
let window = UIWindow(...)
...
// adding Compose:
window.rootViewController = Platform().UserInfoViewController()
The easiest way is to start from our templates: https://github.com/JetBrains/compose-multiplatform-templateVladimir Malykhin
07/24/2023, 4:38 PMChanjung Kim
07/25/2023, 2:49 AM@Composable
fun ModalSheet(content: @Composable () -> Unit) {
val modalSheetController = remember {
ComposeUIViewController {
MaterialTheme(content = content)
}
}
val uiViewController = LocalUIViewController.current
DisposableEffect(uiViewController, modalSheetController) {
uiViewController.presentViewController(modalSheetController, animated = true, completion = null)
onDispose { ... }
}
}
Dima Avdeev
07/26/2023, 3:03 PMOk, but if need add ComposeUIViewController as a child, not root - is it possible?For now it is not working good with UIKit. But, you can use Compose as as Child with SwiftUI technology like in our samples: https://github.com/JetBrains/compose-multiplatform/blob/master/examples/chat/iosApp/iosApp/ComposeInsideSwiftUIScreen.swift#L18