/hilt-conductor

Primary LanguageKotlinApache License 2.0Apache-2.0

hilt-conductor

Use Hilt with Conductor Controllers

Install

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>'
}

Usage

  1. Add @ConductorEntryPoint annotation to your Controller
@ConductorEntryPoint
class MainController(args: Bundle?) : Controller(args)
  1. Install your dagger module in @ControllerComponent
@InstallIn(ControllerComponent::class)
@Module
object MyModule
  1. (Optional) Define the scope with @ControllerScoped annotation
@Provides
@ControllerScoped
fun text(): String = "Hello World"

Todo

  • Handling class qualifier