All Versions
61
Latest Version
Avg Release Cycle
18 days
Latest Release
1826 days ago
Changelog History
Page 7
Changelog History
Page 7
-
v0.2.x Changes
๐ Koin & Koin-Android project has meen merged
DSL
- Module/AndroidModule class must now give a
context()
function implementation, to return a Context object. ThedeclareContext
function unlock the Koin DSL to describe dependencies and injection:
class MykModule : Module() { override fun context() = declareContext { ... } }
- You can now bind additional types for provided definitions
Kotlin class MykModule : Module() { override fun context() = declareContext { provide { Processor() } bind { ProcessorInterface::class} } }
Scope
- ๐ You can declare/reuse paths in your modules, with
modulePath {}
operator. See paths section - ๐ Release modulePath instances with
release()
on a KoinContext
class MainActivityModule : Module() { override fun context() = declareContext { // Scope MainActivity modulePath { MainActivity::class } // provided WeatherService provide { WeatherService(get()) } } }
Android
- ๐
KoinAwareContext
interface used to setup Android application (KoinApplication & KoinMultidexApplication are removed)
class MainApplication : Application(), KoinContextAware { /** * Koin context */ lateinit var context: KoinContext /** * KoinContextAware - Retrieve Koin Context */ override fun getKoin(): KoinContext = context override fun onCreate() { super.onCreate() // insert Koin ! context = Koin().init(this).build(MyModule()) // ... } }
by inject<>()
function operator to inject any dependency in any Activity or Fragment
class MainActivity : AppCompatActivity() { // inject my WeatherService val weatherService by inject<WeatherService>() }
Koin
- ๐ Koin builder takes module instances (instead of module classes):
// fill applicationContext for Koin context val ctx = Koin().init(applicationContext).build(Module1(),Module2()...)
Internal rework for simpler use with Scopes:
- ๐
Koin().build()
return KoinContext - ๐ factory, stack operators have been removed, for the modulePath fatures
- โ delete/remove replaced with
release()
Scope operation - import is replaced with module instances load
- ๐ All reflection & kotlin-reflect code have been removed
- Module/AndroidModule class must now give a