Skip to content

Instantly share code, notes, and snippets.

@rygelouv
Created July 12, 2020 16:14
Show Gist options
  • Select an option

  • Save rygelouv/145c4c21523629f1c20b3bbf3f7ede9d to your computer and use it in GitHub Desktop.

Select an option

Save rygelouv/145c4c21523629f1c20b3bbf3f7ede9d to your computer and use it in GitHub Desktop.
class LiteKoin {
private val registry = ServiceLocator()
lateinit var declarations: Map<KClass<*>, Declaration<Any>>
fun loadModules(modules: List<Module>) {
declarations = modules.declarationRegistry
registry.loadModules(modules)
}
fun resolveInstance(type: KClass<*>) = registry.getService(type)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment