Use Hilt with Conductor Controllers
Step 1. Add the plugin to your root build.gradle
file
buildscript {
...
dependencies {
classpath "io.github.funnydevs:hilt-conductor-plugin:<latest_release>"
}
}
Step 2. Apply plugin in application module of build.gradle
.
plugins {
...
id 'com.funnydevs.hilt-conductor.plugin'
id 'dagger.hilt.android.plugin'
}
Step 3. Add the dependencies inside your module
dependencies {
implementation 'io.github.funnydevs:hilt-conductor:<latest_release>'
(java)
annotationProcessor 'io.github.funnydevs:hilt-conductor-processor:<latest_release>'
(kotlin)
kapt 'io.github.funnydevs:hilt-conductor-processor:<latest_release>'
}
- Add @ConductorEntryPoint annotation to your Controller
@ConductorEntryPoint
class MainController(args: Bundle?) : Controller(args)
- Install your dagger module in @ControllerComponent
@InstallIn(ControllerComponent::class)
@Module
object MyModule
- (Optional) Define the scope with @ControllerScoped annotation
@Provides
@ControllerScoped
fun text(): String = "Hello World"
- Handling class qualifier