Hello, someone has tried to start a simple CMP pro...
# koin
f
Hello, someone has tried to start a simple CMP project with
KoinApplication
using Compose Hot Reload ? The first start is fine, but when the reload is triggered, Koin throws an error as the KoinApplication is called gain.
Koin context has not been initialized in rememberKoinApplication
I know hotReload is new but apparently pretty stable and It will be unavoidable. FYI: the hot reload run on the Desktop/JVM target.
a
try to use startKoin before, and KoinContext only. Even in 4.1 KoinContext & KoinAndroidContext won't be needed anymore
f
Yes, I know the alternative way but I need to write platform specific code, I wanted to avoid to do that.
a
why do you need specific platform code with startKoin?
f
I need to start my iOS and Android App. The desktop App is only needed for hot reload.
KoinApplication
is designed to start a CMP app and avoid
startKoin
, no?
something is missing in the documentation?
a
KoinApplication is one way to go. startKoin can still be used
f
Yes, that’s the way I’m doing it now.
a
I'm still studying impact of KoinApplication on Compose environment start. Making KoinMultiplatformApplication experimental
f
Compose hot reload make the app restart itself. Koin throw an exception on the reload when there is declared modules. With no modules, there is no issues.
a
Compose hot reload make the app restart itself.
from where does it restart?
f
From the documentation, it’s from a CompositionLocal at the root of the Compose Application
Copy code
fun main() {
    singleWindowApplication(
        title = "My CHR App",
        state = WindowState(width = 800.dp, height = 800.dp),
        alwaysOnTop = true
    ) {
        DevelopmentEntryPoint { <-- 
            MainPage()
        }
    }
}