add

fun add(component: Any)

Sets a reference to the application's Dagger graph, so that it can be accessed by internal tooling.

This should be initialized as soon as possible after initializing the AppComponent.

Since

0.13.0

Samples

import tangle.inject.TangleGraph
import tangle.inject.test.utils.Application
import tangle.inject.test.utils.DaggerAppComponent
import tangle.inject.test.utils.Sample
fun main() { 
   //sampleStart 
   class MyApplication : Application() {

  override fun onCreate() {
    super.onCreate()

    val appComponent = DaggerAppComponent.factory()
      .create(this)

    TangleGraph.add(appComponent)
  }
} 
   //sampleEnd
}

Parameters

component

the application-scoped Dagger component

Sources

Link copied to clipboard