Completely new to Compose desktop (multiplatform w...
# compose-desktop
v
Completely new to Compose desktop (multiplatform with Android app too). I've started with this template: https://github.com/JetBrains/compose-multiplatform-template . I think I want a separate UI for Android and Desktop, so I tried to change
main.desktop.kt
from
fun MainView() = App()
to something like:
Copy code
fun MainView() = application {
    Window(
        onCloseRequest = ::exitApplication,
        title = "Corbel",
        state = rememberWindowState(width = 640.dp, height = 480.dp)
    ) {
        DesktopApp()
    }
}
No window appears when I run it though. Am I wrong to try to use the
application { Window(...)...}
code approach that is in the compose multiplatform desktop template in a mixed Android/Desktop project? Without `application { Window... }`I don't even know how to give the window a title!
p
You have a main() function? The code seems ok. In my App I have this:
Copy code
fun main() = application { ... }
If you removed
fun main()
accidentally might be the problem.
Ah.
desktopApp/src/jvmMain/kotlin/main.kt
I've clearly not understood this multiplatform stuff yet.
p
You got it to work?
v
I was editing the wrong file, I think I was nesting multiple calls to
application {...}
but I haven't tested it yet. I stopped for dinner.
👍 1