Extending kotlin-inject for fun & profit
Droidcon SF - June 2024
Abstract
Kotlin-inject is a dependency injection framework for Kotlin Multiplatform. It verifies the dependency graph during compilation and generates the necessary code to instantiate the object graph at runtime. It offers a similar feature set as Dagger 2 without the limitation of being tied to the JVM and Android only.
This talk will offer a short introduction to kotlin-inject and discuss its benefits and downsides and how the framework scales in large, modularized code bases. To close some of the gaps and solve project specific use cases KSP and custom code generators will be used to extend the framework and to give us features similar to the ones Anvil provides for Dagger 2. These practical examples serve as an introduction and blueprint into the meta-programming world to reduce boilerplate and simplify patterns in your code base.