ritesh
11/30/2021, 7:51 PMInterfaceA
interface InterfaceA
And it's concrete implementation with Assisted
inject
class ImplClass @AssistedInject constructor(@Assisted someClass:SomeCLass):InterfaceA {
}
How would you go about using Assisted
Inject in this case, where dagger also requires the binding of concrete class with the interface.
Is below the correct way? or i am missing something?
class ImplClass @AssistedInject constructor(@Assisted someClass:SomeCLass):InterfaceA {
@AssistedFactory
interface DaggerFactory : Factory {
override fun create(someClass:SomeCLass): ImplClass
}
interface Factory {
fun create(someClass:SomeCLass): InterfaceA
}
}
and then, bind it like this
@Module
@InstallIn(ActivityComponent::class)
interface BindsSomething {
@Binds
fun binds(factory: ImplClass.DaggerFactory): ImplClass.Factory
}