koject

Project Url: mori-atsushi/koject
Introduction: DI Container library for Kotlin Multiplatform.
More: Author   ReportBugs   OfficialWebsite   
Tags:

Koject is a DI Container Library for Kolin Multiplatform using KSP.

fun main() {
    Koject.start()

    val controller = inject<Controller>()
}

@Singleton
@Provides
class Api

@Singleton
@Provides
fun provideDB(): DB {
    return DB.create()
}

@Binds
@Singleton
@Provides
class RepositoryImpl(
    private val api: Api,
    private val db: DB,
): Repository

interface Repository

@Provides
class Controller(
    private val repository: Repository
)

Features

  • Support Kotlin Multiplatform
  • Easy provide with annotations
  • Check dependency graph at compile time
  • Code generation with KSP
  • Support multi-module project

Documents

Examples

Koject is inspired by the following libraries.

Apps
About Me
GitHub: Trinea
Facebook: Dev Tools