File tree Expand file tree Collapse file tree 4 files changed +39
-2
lines changed
composeApp/src/androidMain
xyz/teamgravity/viewmodelcomposemultiplatform Expand file tree Collapse file tree 4 files changed +39
-2
lines changed Original file line number Diff line number Diff line change 22<manifest xmlns : android =" http://schemas.android.com/apk/res/android" >
33
44 <application
5+ android : name =" .App"
56 android : allowBackup =" true"
67 android : icon =" @mipmap/ic_launcher"
78 android : label =" @string/app_name"
89 android : roundIcon =" @mipmap/ic_launcher_round"
910 android : supportsRtl =" true"
1011 android : theme =" @android:style/Theme.Material.Light.NoActionBar" >
1112 <activity
12- android : exported = " true "
13+ android : name = " .MainActivity "
1314 android : configChanges =" orientation|screenSize|screenLayout|keyboardHidden|mnc|colorMode|density|fontScale|fontWeightAdjustment|keyboard|layoutDirection|locale|mcc|navigation|smallestScreenSize|touchscreen|uiMode"
14- android : name = " .MainActivity " >
15+ android : exported = " true " >
1516 <intent-filter >
1617 <action android : name =" android.intent.action.MAIN" />
1718
Original file line number Diff line number Diff line change 1+ import android.content.Context
2+ import org.koin.android.ext.koin.androidContext
3+ import org.koin.android.ext.koin.androidLogger
4+ import org.koin.core.context.GlobalContext.startKoin
5+
6+ actual class KoinInitializer (
7+ private val context : Context
8+ ) {
9+
10+ actual fun init () {
11+ startKoin {
12+ androidContext(context)
13+ androidLogger()
14+ modules(applicationModule, viewModelModule)
15+ }
16+ }
17+ }
Original file line number Diff line number Diff line change 1+ import org.koin.androidx.viewmodel.dsl.viewModelOf
2+ import org.koin.core.module.Module
3+ import org.koin.dsl.module
4+
5+ actual val viewModelModule: Module = module {
6+ viewModelOf(::ScreenAViewModel )
7+ }
Original file line number Diff line number Diff line change 1+ package xyz.teamgravity.viewmodelcomposemultiplatform
2+
3+ import KoinInitializer
4+ import android.app.Application
5+
6+ class App : Application () {
7+
8+ override fun onCreate () {
9+ super .onCreate()
10+ KoinInitializer (this ).init ()
11+ }
12+ }
You can’t perform that action at this time.
0 commit comments