Badges: [UPDATED], [FIXED], [ADDED], [DEPRECATED], [REMOVED], [BREAKING]
Android-ViewModel
[ADDED]- debug logging for VM provider
AndroidX-ViewModel
[ADDED]- debug logging for VM provider
Core
[FIXED]- performances update - modules list loading & class naming[BREAKING]-modules(vararg modules: Module)inKoinApplicationhas been removed for performance reasons. Please usemodules(modules: List<Module>)[BREAKING]-modules(modules: Iterable<Module>)inKoinApplicationhas been removed for performance reasons. Please usemodules(modules: List<Module>)[BREAKING]-loadKoinModules(vararg modules: Module)inGlobalContexthas been removed for performance reasons. Please useloadKoinModules(module: Module)orloadKoinModules(modules: List<Module>)[BREAKING]-unloadKoinModules(vararg modules: Module)inGlobalContexthas been removed for performance reasons. Please useunloadKoinModules(module: Module)
Android
[UPDATED]- rework startking DSL to add extension in startKoin (androidContext,androidLogger)
Android-Scope
[UPDATED]- rework according to new Scope API (manage compelte Scope Lifecycle)[ADDED]-currentScopeproperty scope tied to current Activity or Fragment[ADDED]-currentScopeis aware of anyKoinComponent& currentScope override[UPDATED]- ScopeID generation
Android-ViewModel
[ADDED]- support for new Scope API[REMOVED]- removed koin-ext builder API[UPDATED]- make the API open to Koin instance isolation[FIXED]- InsertKoinIO#452 - Named qualifier does not work with view models - Now take qualifier as ViewModel's Tag[FIXED]- by viewModel & getViewModel with clazz version[FIXED]- ViewModel definition in scope
AndroidX-Scope
[UPDATED]- update API regarding the changes inkoin-android-scope[UPDATED]- ScopeID generation
AndroidX-ViewModel
[UPDATED]- update API regarding the changes inkoin-android-viewmodel[FIXED]- InsertKoinIO#452 - Named qualifier does not work with view models - Now take qualifier as ViewModel's Tag[FIXED]- by viewModel & getViewModel with clazz version[FIXED]- ViewModel definition in scope
Core
[UPDATED]- startKoin replaced with startKoin DSL and koin in global context[UPDATED]- complete internals rewritten for performances optimisation (startup & injection)[UPDATED]-KoinComponentnow can overridegetKoin()to target a custom Koin instance ¤tScope()to target a Scope that is used for all injections[ADDED]- koinApplication function to help declare an instance for a local context, in ordoer to help isolated Koin instances[UPDATED]- rework Scope API (multiple instances definitions, properties, release, callback ...)[UPDATED]- rework Scope DSL (scope/scoped) & lock single/factory[UPDATED]- rework internals to use root Scope & separate Scope instances, with different bean registry[ADDED]- onClose, onRelease DSL on single/factory/scoped to execute code when releasing instance or stopping container[ADDED]- getProperty with default value[UPDATED]- Kotlin 1.3.21[ADDED]- Qualifiers withnamed()function to replace old string names. Allow to use Types[ADDED]-getOrNull()andinjectOrNull()to safely resolve potential components and get null of not present[UPDATED]- additional binding API, withgetAll<S>()&bind<P,S>()operator to look for instances regarding secondary type definition[ADDED]-declare()on Koin & Scope, to help declare an instance on the fly[FIXED]- Factory declaration in scope
Test
[UPDATED]- rework testing API, codebase detached from internal core tests[UPDATED]- checkModules now rely on pure Kotlin & withcreateparameters DSL
Java
[UPDATED]- updatedKoinJavaComponentfor the new API[FIXED]- InsertKoinIO#451 - No longer possible to get objects from a scope in Java code -scopeparameter to allow resolve a dependency from this scope instance[FIXED]- Get access to scope instance
Ktor
[UPDATED]- rework startking DSL to add extension in startKoin[ADDED]- Koin as a Ktor feature
Spark
[REMOVED]project non ported to Koin 2.0
Android
[FIXED]Fixed bug with appCompat v26 InsertKoinIO#268[ADDED]Android debug logs shut off InsertKoinIO#251
Android-Scope
[UPDATED]Better scope management when associated to a lifecycle InsertKoinIO#235
Android-ViewModel
[FIXED]Proguard Warning InsertKoinIO#267
Core
[UPDATED]- Updated KoinComponent interface to allow easily add a custom Koin instance InsertKoinIO#224[UPDATED]- Allow nullable injection params InsertKoinIO#242[UPDATED]- Add instance for a dedicated scope InsertKoinIO#277[FIXED]Documentation Typo fixed InsertKoinIO#263[FIXED]Fixed Scope toString in debug InsertKoinIO#240
Core-Ext
[FIXED]Add scopeId param in experimental API builder InsertKoinIO#252
Test
[UPDATED]Review declareMock to add mock lambda expression InsertKoinIO#243[FIXED]Fixed params injection with checkModules InsertKoinIO#274
Android
[FIXED]-koin-android-viewmodel&koin-androidx-viewmodelparameter & factory review - InsertKoinIO#236
Core_
[UPDATED]- compilation with Kotlin 1.2.70[ADDED]- new Scope API[FIXED]- fixed scope visibility resolution - InsertKoinIO#228[FIXED]-koin-android-viewmodelparameters leak
Core-Ext
[ADDED]- Renamedkoin-reflecttokoin-core-ext
Android
[FIXED]-koin-android-viewmodelparameters leak fixed - InsertKoinIO#220[ADDED]-koin-android-viewmodeladdedviewModelautomatic builder keyword[FIXED]-koin-androidadded backandroidApplication()[ADDED]-koin-android-scopeupdatedbindScopefunction now bind aScope
Test
[FIXED]-check()renamed tocheckModules()
Scripts
[UPDATED]- rework all gradle structure and scripts - #126[ADDED]- asciidoc integration - #127[ADDED]- CI integration with CircleCI
Core
[UPDATED]- compilation with Kotlin 1.2.50[UPDATED]- Update DSL keywords:module&single(replacesapplicationContext,context&bean) - #131[FIXED]- Fixed Scope API, aka module visibility resolution[ADDED]- SLF4J Logger implementation (koin-logger-slf4j), used bykoin-spark&koin-ktor- #130[FIXED]- Resolution & error check/catch for display - #110[FIXED]- BeanDefinition equals()[FIXED]- Instance creation error display - #124[UPDATED]- logging tree resolution (with debug data if needed)[ADDED]- asciidoc doc updated - #121 - #100 - #102 - #103[UPDATED]- Injection parameter API with destructured declaration - #133[ADDED]- Preload instances withcreateAtStart- #141[UPDATED]- Explicit bean/module overide - #123[FIXED]- bind operator check assignable types
Test
[ADDED]- asciidoc doc[ADDED]- check() feature to check all configuration (does not create instances like dryRun)[ADDED]- declare mock or other definition out of the box withdeclareMock&declare- #151 - #119
Android
[BREAKING]- Package & project renaming ->koin-android,koin-android-scope&koin-android-viewmodel- #144[REMOVED]- bindString(), bindBool() & bindInt()[ADDED]- asciidoc doc[ADDED]- support AndroidX packages withkoin-androidx-scope&koin-androidx-viewmodel- #138 - #122 - #154[ADDED]- scoping feature with Android lifecycle withkoin-android-scope- #142[UPDATED]- Open startKoin() for other Android context & useContextinstead ofApplication- #156[FIXED]- ViewModel factory instance creation bugfix - #145[FIXED]- ViewModel factory injection params leak - #149[UPDATED]- androix version to2.0.0-beta01
Ktor
[ADDED]- asciidoc doc[ADDED]- usekoin-logger-slf4j[UPDATED]- ktor0.9.2[ADDED]- addRoute&Routingclass extensions - #128
Spark
[ADDED]- asciidoc doc[ADDED]- usekoin-logger-slf4j[UPDATED]-controllerkeyword now need your class to extendSparkController
Java
[ADDED]- addkoin-javaproject - #106[ADDED]- asciidoc doc
Reflect
[ADDED]- addkoin-reflectproject[ADDED]- addbuild()DSL function to allow smarter way of building definition[ADDED]- asciidoc doc
Website
[ADDED]- Doc integration[ADDED]- Getting started integration[FIXED]- Kotlin slack URL - #125
Samples
[ADDED]- Addedexamplesfolder, gathering examples application[ADDED]- Thermosiphon example - #116
Gradle & Continuous Integration
version published with new build chain
Core
[UPDATED]build updated to Kotlin 1.2.31[UPDATED]dissociate overload with dynamic parameters onget()andinject()for better autocomplete suggestions[FIXED]fixstartKoin()property loading from booleanloadProperties[FIXED]inject by name take now care of injected type #92
Android
[FIXED]startKoin()doesn't break RestrictMode anymore and you can avoid properties load directly from koin.properties #96[UPDATED]dissociate overload with dynamic parameters onget()andinject()for better autocomplete suggestions
Android Architecture
[UPDATED]dissociate overload with dynamic parameters onviewModel(),getViewModel()andgetSharedViewModel()` for better autocomplete suggestions[UPDATED]now exclude gradle dependency againstLiveData
Samples
FIXEDKtor hello appp sample
DSL
[FIXED]Parameter propagation - You can now reuse params inget()to propagate it #66
Core
[ADDED]Parameters are now expressed via Kotlin function to allow lazy evaluation #67[UPDATED]Parameter propagation #66[FIXED]Stack resolution engine fixed #72[FIXED]Better Logs, Error & Stacktraces[FIXED]Properties loading from externalpropertiesfile can read values as String/Integer/Float
Android
[ADDED]get()direct dependency eager fetching function for Activity/Fragment/Service #78
Android Architecture
[ADDED]To help misuse the Koin ViewModel API, we introduce thegetSharedViewModel()andsharedViewModel()from Fragment, to reuseViewModelfrom parentActivity.getViewModel()andviewModel()now createsViewModelinstance (noFromActivityparameter anymore)[UPDATED]ViewModel factory logs to see what Activity/Fragment is gettingViewModelinstance
DSL
[DEPRECATED]-provide- can be directly replace withbean[UPDATED]-beanandfactorycan now usebind[ADDED]- defintion function insidebeanorfactorycan now have parameters
Core
[FIXED]Context resolution and modulePath isolation reworked - now fully functionnal[FIXED]Stack resolution[ADDED]StandAloneContextfunctionloadKoinModulesto load Koin modules wether Koin is already started[ADDED]StandAloneContextfunctionloadPropertiesto load Koin properties wether Koin is already started[ADDED]by inject()function handle parameters to definition (#59)[FIXED]Logging with class name need introspection[ADDED]Context lifecycle notification callback - to allow a callback whenreleaseContext()is called on a context. You can register withStandAloneContext.registerContextCallBack()(#58)
Android
[FIXED]StartKoin have aloggerparameter, with default as AndroidLogger(), to allow specify logging implementation to use with Koin (#50) - allow no logging at startKoin of logger is set toEmptyLogger()[ADDED]by inject()function handle parameters to definition (#49)
Android Architecture
[FIXED]fix viewModel extensions rewritten fromLifecycleOwnerinterface[FIXED]fixby viewModel()API to allow use KClass object argument instead of type inference - offers nowgetViewModelByclass()andviewModelByClass()(#56)[ADDED]by viewModel()function handle parameters to definition (#49)[ADDED]by viewModel()function handle key instance for Android ViewModelFactory (#49)
Core
- fix internal instance registry due to compat error with Kolin
1.1.61&1.2.21- broke Koin API for app using jdk 7 under the hood - issue #43
Android Architecture
by viewModel()lazy function call thegetViewModel()function and allowvalattribute declaration of yourViewModel(like withby inject()) - (issue #37)- Better support to share
ViewModelbetween Activity and Fragments android.arch.lifecycle:extensionsupdated to1.1.0
Spark
startSpark {}has been renamed tostart {}and have amodulesarguments to list all of your modulesstart()andstartKoinhas been merged tostart( modules = <List of modules>)stopSpark{}has been renamed tostop {}and includecloseKoin()
Core
- Kotlin
1.2.21 - Internal fixes around Bean definition lookup / Duplicated defintion (issue #39)
- Fixed loading from koin.properties (for embedded jar)
Android Architecture
viewModelDSL keyword (specializedprovidealias for ViewModel), to declare an Architecture Components ViewModelgetViewModel()function in Activities and Fragments, to get and bind ViewModel components
Spark
controller {}DSL keyword (specializedprovidealias), to declare Spark controllers classesstart() {}function to start Spark server (optional port number) - lambda expression to allow the start of Koin and any controller instantiationrunControllers()function to instantiate all spark controllers, declared withcontrollerkeyword DSL
Core
- Better logging and error display
- Some fixes about internals resolution for bound types
Kotlin compilation has been updated to 1.1.61
Core
- Simplified DSL modules: no more need of
Moduleclass. Now use directly theapplicationContextfunction - Default Koin Logger to
PrintLoggerinstead ofEmptyLogger - a definition can be overriden (with a definition same name and type)
- DSL
providealiases withbeanandfactory - direct interface binding writing style (avoid to use
bindkeyword) - Koin instances resolution is now thread safe and compatible with coroutines
- starter chain reviewed to allow better extension of
startKoin() - better logs to display how instance and reoslution are made
- Context isolation disabled by default. Can be activitaed later
Android
- Default Koin Logger to
AndroidLoggerinstead ofEmptyLogger - No need anymore of
AndroidModule, just useapplicationContextto declare a module - Android extensions have been reworked to avoid need of support Library
androidApplication()is a DSL extension to provide AndroidApplicationresolution (can also be done withget<Application>())
Samples
- Updated Android weather app, with multiple Activity and better demo for property usage
- Simple Kotlin app sample added
## [0.6.1]()
Core
- Added context/sub-contexts visibility checks
startKoin()is now part of standAloenContextcloseKoin()now close actual Koin contextKoinComponenthasget()andgetProperty()
Android
- reworked
starKoin()function - reviewed android base extensions to find high-level extension point
Samples
- added kotlin-simpleapp - sample application for pure Kotlin
- added ktor-starter - for demoing Koin for Ktor web app development
Ktor
- koin-ktor module has been started
The target of this release was to simplify and make clearer the syntax of Koin.
DSL
getPropertiescan now have a default value
Core
-
Stand alone complex & KoinComponent have been reviewed
-
renamed startContext functions to
startKoin() -
KoinComponent
- inject/property
- setProperty
- release context or properties
- startKoin
-
Koin can load properties from koin.properties file or system properties
-
startKoin()have now apropertiesparameter to give additional properties at startup
KoinTest
- directly extends
KoinComponent - context assert/test tools & extensions
dryRun()is usable in a Kointest component, after astartKoin
Android
- fix/better extensions for Android
bindProperty()renamed tosetProperty()startAndroidContext()has been renamed tostartKoin()- ContextAware Components can be configured for drop stratgey (onDestroy or onPause). Default method is onPause
- load assets/koin.properties if present
Core
getProperty()can provide a default value if key property is missingprovide()can be use on a KoinContext directly, to declare on component
Android
applicationContexthas been renamedandroidApplication
Core
- property value set does not allow Any? value
- starters builder have been moved to [test] & [android]
- removed base starter
Android
- starter builder extension for Application class only
Tests
- starter builder extension for KoinTest class only
javadoc is now generated with Dokka
Core
- Koin now provide a stand alone context support to provide koin context in an agnostic way
startContextfunction to start a Koin context- property injection/resolution is now strict. Property injection is not nullable anymore
koinContext.removeProperties()remove properties by their keys- Simple logger to help logging/debugging
Android
startAndroidContextfunction to start an Android Koin contextKoinContextAwareinterfaces have been removed- Koin/Android extensions greatly simplified
- packages have been moved - need reimport for AndroidModule,
by injectandby property ContextAwareActivity&ContextAwareFragmentare components to help you automatically release contexts - don't hesitate to do it manually
Tests
- Creation of 'org.koin:koin-test:' module, provide testing feature about Koin
Koin DSL has been reviewed to be more easy to understand, and allow easy writing of modules. No need anymore of several module classes, you can now include subcontexts in one module. You can now provide factory components, and bind is simpler to write.
The dry run feature, allows to run all of you modules in order to check if dependency graph is complete.
DSL
- replaced
declareContext{}has been renamedapplicationContext{}, and behind gives a better idea that you are describing your application context (the root context of your app) - Updated
modulePath(){}has been dropped forcontext(){}- context describes a sub context of your application, has a a name and can have also sub context itself (sub contexts are hierarchicals) - Updated
bind{}doesn't need lambda anymore to declare your bound class, but just the class in argument:bind() - Added
provideFactoryis a DSL keyword to provide a factory definition instead of singleton
Core
- Updated
KoinContext.release()is now called with context's name, no owner class instance - Added
KoinContext.dryRun()help to run your modules and check if every dependency can be injected
Sample App & Android
- updated for the new core update
Core
- Kotlin 1.1.51
- Removed all loggers - rethinking of better Log/API
Android
- KoinContext function builders : newKoinContext & lazyKoinContext
- KoinContextAware interface now has a property, instead of a getter - better to overload
Sample App
- moved to folder koin-sample-app
Core
- Kotlin 1.1.50
- KoinContext / Context - simplified operator injection (removed all nullable inject/get)
- KoinContext.get() can make Injection by name
- Koin.build() can now build a list of Module
DSL
- Context.get() can now provide a definition with a name
- Context.get() operator have a bind property, to specify list of compatible interfaces to bind - is an alternative to bind {} operator
Android
- Merge android & android-support modules
- inject() can't be null anymore
- inject() can inject component by its name
- property() can do property injection - can be nullable data
Sample App
- Sample app (Weather demo application) has been reviewed to be more complete : Full MVP example, RxJava Scheduling, Unit Tests with partial modules loading & mocks
Koin & Koin-Android project has meen merged
DSL
- Module/AndroiModule class must now give a
context()function implementation, to return a Context object. ThedeclareContextfunction 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
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
KoinAwareContextinterface 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 replcaed with
release()Scope operation - import is replaced with module instances load
- All reflection & kotlin-reflect code have been removed