Kinject
This library should not be used in production. It was made from a series of blog posts on
creating a Kotlin Dependency Injection Library. You can find all the posts here.
A multiplatform Dependency Injection library.
Artifacts

implementation("dev.scottpierce:kinject-core:<latest version here>")
Basic Usage
Dependencies:
class A
class B(val a: A)
class C(
val a: A,
val b: B,
)
Usage:
val graph = objectGraph {
singleton(A())
singleton { B(a = get()) }
singleton { C(a = get(), b = get()) }
}
val a: A = graph.get()
val b: B = graph.get()
val c: C = graph.get()
Adding an ObjectGraph to another ObjectGraph
ObjectGraphs can be added together to scope dependencies. After adding a graph, all of it's
dependencies become accessible to the new graph.
val graph1 = objectGraph {
singleton(A())
singleton { B(a = get()) }
}
val graph2 = objectGraph {
add(graph1)
singleton { C(a = get(), b = get()) }
}
val a: A = graph2.get()
val b: B = graph2.get()
val c: C = graph2.get()