feat(01-04): add Koin + Kermit bootstrap commonMain + iOS bridge
- Add initKoin(config) helper wrapping startKoin { modules(appModule) } (PITFALL #4 single entry)
- Add empty appModule placeholder (D-14) — Phase 2+ extends
- Add configureLogging() setting Kermit tag "recipe" (D-15)
- Add iosMain doInitKoin() bridge — Swift-accessible as KoinIosKt.doInitKoin()
- configureLogging() always runs before initKoin() so module loading can log
This commit is contained in:
@@ -0,0 +1,8 @@
|
|||||||
|
package dev.ulfrx.recipe.di
|
||||||
|
|
||||||
|
import org.koin.dsl.module
|
||||||
|
|
||||||
|
// Phase 2 adds authModule; Phase 4 adds syncModule; Phase 5 adds catalogModule; etc.
|
||||||
|
val appModule = module {
|
||||||
|
// intentionally empty in Phase 1
|
||||||
|
}
|
||||||
10
composeApp/src/commonMain/kotlin/dev/ulfrx/recipe/di/Koin.kt
Normal file
10
composeApp/src/commonMain/kotlin/dev/ulfrx/recipe/di/Koin.kt
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
package dev.ulfrx.recipe.di
|
||||||
|
|
||||||
|
import org.koin.core.KoinApplication
|
||||||
|
import org.koin.core.context.startKoin
|
||||||
|
import org.koin.dsl.KoinAppDeclaration
|
||||||
|
|
||||||
|
fun initKoin(config: KoinAppDeclaration? = null): KoinApplication = startKoin {
|
||||||
|
config?.invoke(this)
|
||||||
|
modules(appModule)
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package dev.ulfrx.recipe.logging
|
||||||
|
|
||||||
|
import co.touchlab.kermit.Logger
|
||||||
|
|
||||||
|
fun configureLogging() {
|
||||||
|
Logger.setTag("recipe")
|
||||||
|
// Platform log writers (OSLog iOS, LogCat Android, System.out JVM/Wasm) install by default.
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package dev.ulfrx.recipe.di
|
||||||
|
|
||||||
|
import dev.ulfrx.recipe.logging.configureLogging
|
||||||
|
|
||||||
|
fun doInitKoin() {
|
||||||
|
configureLogging()
|
||||||
|
initKoin()
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user