Dependency Injection with Koin on Android.

A pragmatic lightweight dependency injection framework for Kotlin developers. Written in pure Kotlin using functional resolution only: no proxy, no code generation, no reflection!
Office Website — https://insert-koin.io/

Why Koin?

Koin is easy, simple & well documented. It is perfect for encapsulated feature/library modules.

How Koin Works ?

The koin works on simple DSL model. Here we have to create module first. In this module all the dependent objects are there, then we have to load one or more modules in koin. Then, we are ready to use this object. Generally we are loading module in to koin in application class by calling startKoin method,then we can inject the object wherever we want,this how the Koin works.

With Koin, setting up dependency injection is kind of a manual process, you essentially plug your services into the module graphs and those dependencies will later get resolved at runtime.

Lines of code

If you just want to download the code and check it by yourself, the repository is :

https://github.com/rajextreme9476/KoinDISample

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Raviraj Desai

Raviraj Desai

Senior Manager at Axis Bank (Android — Kotlin lover. Tech stack: MVVM, Dagger2, Coroutines, RxJava2, Android Architecture Component ,Flutter Enthusiast ,Ejabber