koin-annotations
koin-annotations copied to clipboard
Dulplicated module instance generation.
trafficstars
i want to pass a parameter through a module constructor like this:
@Module
class ApplicationModule(private val context: Context) {
@Factory
@Qualifier(name = AppIdentifier.applicationContext)
fun applicationContext(): Context = context
}
but the generated code i got:
public val com_music_android_lin_modules_ApplicationModule : Module get() = module {
// this is what i`m confused, we have a extension function below with a already created instance provided.
// so why we need to generate another instance once more?
val moduleInstance = com.music.android.lin.modules.ApplicationModule()
// xxxx
}
public val com.music.android.lin.modules.ApplicationModule.module : org.koin.core.module.Module get() = com_music_android_lin_modules_ApplicationModule
with this issue, can we just simplify this code generator? or does the code template i provided above match the best practice?