Ok so seems I can do this now: ``` fun createMa...
# compose-ios
j
Ok so seems I can do this now:
Copy code
fun createMainScreenController(): UIViewController {
        return ComposeUIViewController(configure = {
            onFocusBehavior = OnFocusBehavior.DoNothing
            platformLayers = false
        }) {
            KoinComponent.rootContent()
        }
    }
To rollback to old behaviour, as the new one crashing the entire app in iOS.
i
Please open an issue with your problem/crash
cc @Dima Avdeev
j
To be honest I am not entirely sure what to type. But if I am using a Dialog, like Bottomsheet or Material date picker, or Circuit content overlay it crashes because missing Local compositions. Dont know whats changed, so not sure what to refer to. It doesnt inherit LocalCompositions properly with the new solution it seems. I worked around it at the moment + rollbacked the flag to false, so I can do both ๐Ÿ™‚
i
like Bottomsheet or Material date picker
It works just fine for me ๐Ÿค” Could you please share minimal repro project?
j
Hmm cant share the project I am working on, not sure at which level. Can it be multiple gradle modules dependecies somehow? Having very odd behaviour with Gradle sync in general as well. When using your own LocalCOmpositions provided it crashes for me immediatly. I will see if I can try reproduce from sample project quickly.
๐Ÿ‘ 1
@Ivan Matkov Pretty much just use kmp.jetbrains.com and modify to this:
Copy code
val LocalString = staticCompositionLocalOf<String> { error(
    "Need string provided"
) }

@OptIn(ExperimentalResourceApi::class)
@Composable
fun App() {
    CompositionLocalProvider(LocalString provides "test") {
        MaterialTheme {
            val greeting = remember { Greeting().greet() }
            val modalBottomSheetState = rememberModalBottomSheetState()
            Column(Modifier.fillMaxWidth(), horizontalAlignment = Alignment.CenterHorizontally) {
                ModalBottomSheet(
                    sheetState = modalBottomSheetState,
                    onDismissRequest = {

                    }
                ) {
                    Column(Modifier.fillMaxWidth(), horizontalAlignment = Alignment.CenterHorizontally) {
                        Image(painterResource(DrawableResource("files/compose-multiplatform.xml")), null)
                        Text("Compose: $greeting and ${LocalString.current}")
                    }
                }
            }
        }
    }

}
Crashes immediatly in iOS. Working fine in Android however ๐Ÿ™‚
๐Ÿ‘€ 1
Stacktrace
i
Thanks. We'll take a look
j
If you do this change it works:
Copy code
fun MainViewController() = ComposeUIViewController(configure = {
    platformLayers = false
}) { App() }
My guess is that ComposeView / ComposeContext not inherits Local compositions map correct between child composables, as it normally do. But just a guess ๐Ÿ™‚
i
It's a bit complicated but in general - yes. It separated more than it should - currently it has own recomposer to invalidate it independently. It was made to provide ability to create dialogs outside of initial view (or even window on Desktop). We'll take a look/provide missing things to child context
j
Right, yeah same issue in Android when have to provide a separate theme for Dialogs kind a. I understand different in desktop / iOS etc ๐Ÿ™‚ Thanks! Good to know I am not insane. Spent a lot of hours refactoring my entire app to duplicate same Local compositions nested ๐Ÿ˜„
Anyway its good, I also found another problem in Circuit library when did this, I need to file another issue to ... ๐Ÿ˜›
i
Should be fixed in the next build
๐Ÿ‘€ 1
๐ŸŽ‰ 1
๐Ÿ‘ 1
j
Wow that was fast! ๐Ÿ˜ฎ
i
Well it's still a draft that requires team's discussion. In theory locals context was already passed to dialog layers inside composition context, but we cannot extract it from there explicitly since it's internal to runtime module. Passing it separately requires exposing new property, so it's quick but not super clean fix...
๐Ÿ‘ 1
j
Right, yeah I need to learn more about Skiko and composition contexts it seems. Would be really cool understand better how iOS working under the hood. I was especially, except from this case very interested in learning how performance impacted by these things like local compositions, GCC, canvas drawing etc. Is there any articles about this topic if you know, or anything Jetbrains could share? ๐Ÿ™‚
i
the code in open-source is the best source for learning ๐Ÿ˜… Aside of joking, it's still under active development, so nothing to share here yet (as far as I know)
j
Haha yeah, as in code is the best documentation ๐Ÿ˜œ I see. Yeah there is some performance benchmarks out there. Was keen try myself and learn how it actually working. Comparing like Flutter Intersteller vs Skia/Skiko in iOS and overall Compose performance in JVM GCC world compared to things like ObjC and Swift in iOS world. Not much interesting articles about this topic, and hard follow the core things wrapping multiple layers of open source things between each other ๐Ÿ˜„