Since I started using Kotlin, I’ve been frustrated by the lack of proper dependency injection support.
Dagger 1 & 2 both require some java code (although Dagger 2 requires less of it) and Guice is very expensive both in term of overhead and weight (Guice depends on Guava, which, IMHO, is a problem regarding the 64k method reference limit in Android).
Furthermore, those dependency injection library do not really take advantage of Kotlin’s features.
So, I have created a small dependency injection library. It is very small and will probably not fit the need of huge projects with hundreds of modules and bindings but:
- It does the job pretty well in my projects.
- It is dependency free and very lightweight.
- It uses kotlin’s features whenever it can, making it very easy to use in Kotlin.
As I said, it is very lightweight (by design) and therefore has less advanced features than Guice or Dagger.
At least it does dependency binding and injection in a manner that satisfies me.
Here’s the link. I’d love to hear your thoughts if you have a moment to look at it.