同步操作将从 Gitee 极速下载/koin 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
Badges: [UPDATED]
, [FIXED]
, [ADDED]
, [DEPRECATED]
, [REMOVED]
, [BREAKING]
[FIXED]
GetOrNull hide exceptions - https://github.com/InsertKoinIO/koin/issues/913
[FIXED]
SingleInstanceFactory concurrency fixed - https://github.com/InsertKoinIO/koin/pull/914
[ADDED]
add createEagerInstances
parameter to Koin.loadModule
, Koin.loadModules
[FIXED]
@KoinApiExtension is using Warning compiler message, not error[FIXED]
Fix Scoped Components (ScopeActivity, ScopeFragment & ScopeService) to keep scope
lazy and avoid forced initialisation[FIXED]
AndroidX ViewModel API merge for stateViewModel. No need anymore to pass Bundle as injected parameters, jsut use get()
[FIXED]
Resolution API to precise generic type to Any
[ADDED]
JetNews Compose app exampleUpdated to kotlin 1.4.10
koin-androidx-scope
[FIXED]
added scopeActivity
& requireScopeActivity()
API on ScopeFragmentkoin-androidx-compose
[ADDED]
New API to inject Jetpack Compose: get()
, by inject()
, getKoin()
[ADDED]
New API to inject Jetpack Compose with ViewModel: getViewModel()
, by viewModel()
koin-androidx-workmanager
[ADDED]
New API to declare your ListenableWorker
with worker { }
DSL[ADDED]
KoinWorkerFactory wired to the standard WorkManagerFactory, to let build declared component. Use workManagerFactory()
in your KoinApplication
DSL to setup the WorkManagerFactory. (nb: tedious to checkModules - as it depends on android internals)koin-core
[ADDED]
KoinExtensionAPI: annotation for tagging Koin API usage. i.e: KoinComponent requires OptIn, as it's part of Koin API extension[FIXED]
turn all API to internal as possiblekoin-test
[FIXED]
revert AutoCloseKoinTest
to class, add ClosingKoinTest
interfacekoin-androidx-scope
[ADDED]
New ScopeActivity
. ScopeFragment
, ScopeService
to enable Scope API direclty into Android components. Offers injection directly from tied Scope.[BREAKING]
Old Scope API extensions are deprecated: scope
, lifecycleScope
koin-android-scope
[ADDED]
New ScopeActivity
. ScopeFragment
, ScopeService
to enable Scope API direclty into Android components. Offers injection directly from tied Scope.[BREAKING]
Old Scope API extensions are deprecated: scope
, lifecycleScope
koin-androidx-viewmodel
[ADDED]
New ViewModelOwnerDefinition
API definition for lazy define ViewModelStore & SavedStateRegistryOwner[BREAKING]
rewrite ViewModel API to better use StateViewModel factory and allow to use ViewModelOwnerDefinition = () -> ViewModelOwner
ViewModelOwner lazy definition. Bundle is now used as state
lazy attributes, BundleDefinition = () -> Bundle
[ADDED]
verification to help check parameter injection for SavedStateRegistryOwner, as the right argument (misplaced injection param)[ADDED]
New ViewModelOwnerDefinition
API definition for lazy define ViewModelStore & SavedStateRegistryOwner[BREAKING]
rewrite ViewModel API to better use StateViewModel factory and allow to use ViewModelOwnerDefinition = () -> ViewModelOwner
ViewModelOwner lazy definition. Bundle is now used as state
lazy attributes, BundleDefinition = () -> Bundle
[ADDED]
verification to help check parameter injection for SavedStateRegistryOwner, as the right argument (misplaced injection param)koin-android-viewmodel
[ADDED]
New ViewModelOwnerDefinition
API definition for lazy define ViewModelStore[BREAKING]
rewrite ViewModel API and allow to use ViewModelOwnerDefinition = () -> ViewModelOwner
ViewModelOwner lazy definition[ADDED]
New ViewModelOwnerDefinition
API definition for lazy define ViewModelStore[BREAKING]
rewrite ViewModel API and allow to use ViewModelOwnerDefinition = () -> ViewModelOwner
ViewModelOwner lazy definitionkoin-core
[FIXED]
fixed time API - Kotlin 1.4[ADDED]
New KoinScopeComponent
to help build component with Koin scopes[REMOVED]
removed generic Scope API extensions, was preivously on any class. Please use now KoinScopeComponent
[DEPRECATED]
KoinContextHandler in favor of GlobalContext[ADDED]
Better Definition to help further Kotlin Compiler Plugin, simplify Module loading process (API to help declare definition without DSL)[REMOVED]
ScopeDefinition internal from module, and prefer qualifier to avoid create stucture outside of registry[REMOVED]
removed inconsistent synchronized calls[ADDED]
cleaned synchronized API - better call from GlobalContext to ensure synced call[BREAKING]
empty scope is not taken in account anymore, a scope definition is created only if there is at least one scoped definition[ADDED]
Injection parameters can be used directly as a dependency and can be resolved as get()
or directly with builder API[FIXED]
fixed starting context effect (deprecating KoinContextHanlder for GlobalContext)koin-test
[FIXED]
fixed checkModules to use Mock for injected parameters or default origin value of a Scope[ADDED]
setup detault values for injected parameters, for checkModules[BREAKING]
AutoCloseKoinTest
is now an interface, please remove any constructor[UPDATED]
fixed DefinitionParameters
to add the ability to know the injected type valuekoin-test-junit5
[ADDED]
JUnit5 test modulekoin-core
[BREAKING]
Disable property type cast https://github.com/InsertKoinIO/koin/pull/781
[FIXED]
Scope issue - Breaking looping linked scopes when first got instance https://github.com/InsertKoinIO/koin/pull/775
[FIXED]
On the fly declaration with primary type fix - https://github.com/InsertKoinIO/koin/pull/773
koin-androidx-viewmodel
[FIXED]
stateViewModel bundle argument fixed - https://github.com/InsertKoinIO/koin/pull/795/files
[ADDED]
added stateSharedViewModel
extensions for Fragment
https://github.com/InsertKoinIO/koin/pull/768/files
koin-androidx-fragment
[FIXED]
Add fallback for instantiate function in FragmentFactory - https://github.com/InsertKoinIO/koin/pull/742
koin-test
[FIXED]
KoinTestRule test exception handling - https://github.com/InsertKoinIO/koin/pull/808
koin-gradle-plugin
[FIXED]
Fixed Koin gradle plugin task for Kotlin & Android project. Added checkAndroidModules
task - https://github.com/InsertKoinIO/koin/pull/817
Core
[FIXED]
- declare to use reified type[FIXED]
- Qualifier type as pure string[FIXED]
- docs contribution[UPDATED]
- Kotlin 1.3.71Ktor
[ADDED]
- Contributions about modules and eventsAndroidX-Fragment
[FIXED]
- contribution to help fallback on empty constructor instance for FragmentFactoryCore
[ADDED]
- Scope's source value to return the object instance, source of the scope[FIXED]
- maven metadata config :([UPDATED]
- maven metadata configCore
[FIXED]
- fixed integration for kotlin.time.* API with 1.3.70AndroidX-ViewModel
[FIXED]
- shared ViewModel API to get instance from Activity's ViewModelStore + clean of API to use directly ViewModelStoreOwner instead of LifecycleOwnerAndroid-ViewModel
[FIXED]
- shared ViewModel API to get instance from Activity's ViewModelStore + clean of API to use directly ViewModelStoreOwner instead of LifecycleOwnerCore
[UPDATED]
- introduce the KoinContextHandler
component that is responsible to manage GlobalContext
from startKoin. This will allow us to unlock new kind of context for Koin MP & better isolation (not directly a object that we pass around). To get your Koin instance, now use KoinContextHandler.get()
, once you have started it. koinApplication { }
users have to register manually to KoinContextHandler
if neededTest
[ADDED]
- CheckModule categoryGradle_PLugin
[ADDED]
- CheckModule Gradle PluginCore
[ADDED]
- Enum class can be used as Qualifier: named(MyEnum.MyValue)
Core
[FIXED]
- stopKoin closes scopes #702AndroidX-ViewModel
[FIXED]
- added/fixed for better State ViewModel getStateViewModel
and by stateViewModel()
APIAndroid
[ADDED]
- KoinAndroidApplication
to let you create a KoinApplication
instance with Android context, and let you use KoinApplication DSLCore
[UPDATED]
- updated +
oprator for modules[ADDED]
- Scope Links, to link scope to another and help resolve shared instancesDocs
[UPDATED]
- updated koin-core
Scope
section[ADDED]
- inject on a setter property with inject()
Android-Scope
[UPDATED]
- updated currentScope
to use lifecycleScope
instead[FIXED]
- ScopeCompat
for Java compat functionAndroidX-Scope
[UPDATED]
- updated currentScope
to use lifecycleScope
instead[FIXED]
- ScopeCompat
for Java compat functionAndroidX-Factory
[FIXED]
- Fragment
declaration in a scopeCore
[ADDED]
- DSL declare a scope with type directly with scope<MyType> { ... }
[ADDED]
- smarter better API to use scope from an object instance (getOrCreateScope
...)[ADDED]
- scope
property to any instance, to get tied declared scope[ADDED]
- inject on a setter property with inject()
Core-Ext
[ADDED]
- inject all setter property with inject()
on an instanceAndroid-ViewModel
[UPDATED]
- updated ViewModelParameter
API around to help integrate it more easily with 3rd party accessAndroidX-ViewModel
[UPDATED]
- updated ViewModelParameter
API around to help integrate it more easily with 3rd party accessAndroidX-Factory
[ADDED]
- KoinFragmentFactory
API to setup Fragment
injectionCore
[UPDATED]
- Reworked all resolution engine to use immutable BeanDefinition & base the resolution on Scope
& ScopeDefinition
[UPDATED]
- Locking Strategy to avoid usage of ConcurrentHashMap[UPDATED]
- Replace BeanRegistry with InstanceRegistry & ScopeRegistry[UPDATED]
- added closed
status to Scope[FIXED]
- Fixed bugs related to closed scopes[FIXED]
- Can now allow to resolve different types with same Qualifer[ADDED]
- Module loaded
property in order to allow later "reloading"[ADDED]
- Java helpers are now part of the koin-core
project[ADDED]
- bind() oeprator on a definition, that use reified Type[ADDED]
- q() operator to declare a String or a TypeJava
[REMOVED]
- project is now part of koin-core
Test
[UPDATED]
- Check modules with checkModules { }
that open an KoinApplication declaration[ADDED]
- MockProviderRule
& MockProvider
to manually provide mocking capacity, absed of the desired mocing framework[REMOVED]
- Link to Mockito
libraryDocumentation
[UPDATED]
- New documentation system based on docisfy, to help deploy easily markdown doc. Documentation is now in /docs
folderAndroid-ViewModel
[ADDED]
- debug logging for VM providerAndroidX-ViewModel
[ADDED]
- debug logging for VM providerCore
[FIXED]
- performances update - modules list loading & class naming[BREAKING]
- modules(vararg modules: Module)
in KoinApplication
has been removed for performance reasons. Please use modules(modules: List<Module>)
[BREAKING]
- modules(modules: Iterable<Module>)
in KoinApplication
has been removed for performance reasons. Please use modules(modules: List<Module>)
[BREAKING]
- loadKoinModules(vararg modules: Module)
in GlobalContext
has been removed for performance reasons. Please use loadKoinModules(module: Module)
or loadKoinModules(modules: List<Module>)
[BREAKING]
- unloadKoinModules(vararg modules: Module)
in GlobalContext
has been removed for performance reasons. Please use unloadKoinModules(module: Module)
Android
[UPDATED]
- rework startking DSL to add extension in startKoin (androidContext
, androidLogger
)Android-Scope
[UPDATED]
- rework according to new Scope API (manage complete Scope Lifecycle)[ADDED]
- currentScope
property scope tied to current Activity or Fragment[ADDED]
- currentScope
is aware of any KoinComponent
& currentScope override[UPDATED]
- ScopeID generationAndroid-ViewModel
[ADDED]
- support for new Scope API[REMOVED]
- removed koin-ext builder API[UPDATED]
- make the API open to Koin instance isolation[FIXED]
- https://github.com/InsertKoinIO/koin/issues/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 scopeAndroidX-Scope
[UPDATED]
- update API regarding the changes in koin-android-scope
[UPDATED]
- ScopeID generationAndroidX-ViewModel
[UPDATED]
- update API regarding the changes in koin-android-viewmodel
[FIXED]
- https://github.com/InsertKoinIO/koin/issues/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 scopeCore
[UPDATED]
- startKoin replaced with startKoin DSL and koin in global context[UPDATED]
- complete internals rewritten for performances optimisation (startup & injection)[UPDATED]
- KoinComponent
now can override getKoin()
to target a custom Koin instance & currentScope()
to target a Scope that is used for all injections[ADDED]
- koinApplication function to help declare an instance for a local context, in order 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 with named()
function to replace old string names. Allow to use Types[ADDED]
- getOrNull()
and injectOrNull()
to safely resolve potential components and get null of not present[UPDATED]
- additional binding API, with getAll<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 scopeTest
[UPDATED]
- rework testing API, codebase detached from internal core tests[UPDATED]
- checkModules now rely on pure Kotlin & with create
parameters DSLJava
[UPDATED]
- updated KoinJavaComponent
for the new API[FIXED]
- https://github.com/InsertKoinIO/koin/issues/451 - No longer possible to get objects from a scope in Java code - scope
parameter to allow resolve a dependency from this scope instance[FIXED]
- Get access to scope instanceKtor
[UPDATED]
- rework startking DSL to add extension in startKoin[ADDED]
- Koin as a Ktor featureSpark
[REMOVED]
project non ported to Koin 2.0Android
[FIXED]
Fixed bug with appCompat v26 https://github.com/InsertKoinIO/koin/pull/268
[ADDED]
Android debug logs shut off https://github.com/InsertKoinIO/koin/issues/251
Android-Scope
[UPDATED]
Better scope management when associated to a lifecycle https://github.com/InsertKoinIO/koin/issues/235
Android-ViewModel
[FIXED]
Proguard Warning https://github.com/InsertKoinIO/koin/pull/267
Core
[UPDATED]
- Updated KoinComponent interface to allow easily add a custom Koin instance https://github.com/InsertKoinIO/koin/issues/224
[UPDATED]
- Allow nullable injection params https://github.com/InsertKoinIO/koin/pull/242
[UPDATED]
- Add instance for a dedicated scope https://github.com/InsertKoinIO/koin/issues/277
[FIXED]
Documentation Typo fixed https://github.com/InsertKoinIO/koin/pull/263
[FIXED]
Fixed Scope toString in debug https://github.com/InsertKoinIO/koin/issues/240
Core-Ext
[FIXED]
Add scopeId param in experimental API builder https://github.com/InsertKoinIO/koin/pull/252
Test
[UPDATED]
Review declareMock to add mock lambda expression https://github.com/InsertKoinIO/koin/issues/243
[FIXED]
Fixed params injection with checkModules https://github.com/InsertKoinIO/koin/issues/274
Android
[FIXED]
- koin-android-viewmodel
& koin-androidx-viewmodel
parameter & factory review - https://github.com/InsertKoinIO/koin/issues/236
Core_
[UPDATED]
- compilation with Kotlin 1.2.70[ADDED]
- new Scope API[FIXED]
- fixed scope visibility resolution - https://github.com/InsertKoinIO/koin/issues/228
[FIXED]
- koin-android-viewmodel
parameters leakCore-Ext
[ADDED]
- Renamed koin-reflect
to koin-core-ext
Android
[FIXED]
- koin-android-viewmodel
parameters leak fixed - https://github.com/InsertKoinIO/koin/issues/220
[ADDED]
- koin-android-viewmodel
added viewModel
automatic builder keyword[FIXED]
- koin-android
added back androidApplication()
[ADDED]
- koin-android-scope
updated bindScope
function now bind a Scope
Test
[FIXED]
- check()
renamed to checkModules()
Scripts
[UPDATED]
- rework all gradle structure and scripts - #126
[ADDED]
- asciidoc integration - #127
[ADDED]
- CI integration with CircleCICore
[UPDATED]
- compilation with Kotlin 1.2.50[UPDATED]
- Update DSL keywords: module
& single
(replaces applicationContext
, context
& bean
) - #131
[FIXED]
- Fixed Scope API, aka module visibility resolution[ADDED]
- SLF4J Logger implementation (koin-logger-slf4j
), used by koin-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 with createAtStart
- #141
[UPDATED]
- Explicit bean/module override - #123
[FIXED]
- bind operator check assignable typesTest
[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 with declareMock
& 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 with koin-androidx-scope
& koin-androidx-viewmodel
- #138 - #122 - #154
[ADDED]
- scoping feature with Android lifecycle with koin-android-scope
- #142
[UPDATED]
- Open startKoin() for other Android context & use Context
instead of Application
- #156
[FIXED]
- ViewModel factory instance creation bugfix - #145
[FIXED]
- ViewModel factory injection params leak - #149
[UPDATED]
- androix version to 2.0.0-beta01
Ktor
[ADDED]
- asciidoc doc[ADDED]
- use koin-logger-slf4j
[UPDATED]
- ktor 0.9.2
[ADDED]
- add Route
& Routing
class extensions - #128
Spark
[ADDED]
- asciidoc doc[ADDED]
- use koin-logger-slf4j
[UPDATED]
- controller
keyword now need your class to extend SparkController
Java
[ADDED]
- add koin-java
project - #106
[ADDED]
- asciidoc docReflect
[ADDED]
- add koin-reflect
project[ADDED]
- add build()
DSL function to allow smarter way of building definition[ADDED]
- asciidoc docWebsite
[ADDED]
- Doc integration[ADDED]
- Getting started integration[FIXED]
- Kotlin slack URL - #125
Samples
[ADDED]
- Added examples
folder, 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 on get()
and inject()
for better autocomplete suggestions[FIXED]
fix startKoin()
property loading from boolean loadProperties
[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 on get()
and inject()
for better autocomplete suggestionsAndroid Architecture
[UPDATED]
dissociate overload with dynamic parameters on viewModel(),
getViewModel()and
getSharedViewModel()` for better autocomplete suggestions[UPDATED]
now exclude gradle dependency against LiveData
Samples
FIXED
Ktor hello appp sampleDSL
[FIXED]
Parameter propagation - You can now reuse params in get()
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 external properties
file can read values as String/Integer/FloatAndroid
[ADDED]
get()
direct dependency eager fetching function for Activity/Fragment/Service #78
Android Architecture
[ADDED]
To help misuse the Koin ViewModel API, we introduce the getSharedViewModel()
and sharedViewModel()
from Fragment, to reuse ViewModel
from parent Activity
. getViewModel()
and viewModel()
now creates ViewModel
instance (no FromActivity
parameter anymore)[UPDATED]
ViewModel factory logs to see what Activity/Fragment is getting ViewModel
instanceDSL
[DEPRECATED]
- provide
- can be directly replace with bean
[UPDATED]
- bean
and factory
can now use bind
[ADDED]
- defintion function inside bean
or factory
can now have parametersCore
[FIXED]
Context resolution and modulePath isolation reworked - now fully functionnal[FIXED]
Stack resolution[ADDED]
StandAloneContext
function loadKoinModules
to load Koin modules whether Koin is already started[ADDED]
StandAloneContext
function loadProperties
to load Koin properties whether 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 when releaseContext()
is called on a context. You can register with StandAloneContext.registerContextCallBack()
(#58)Android
[FIXED]
StartKoin have a logger
parameter, with default as AndroidLogger(), to allow specify logging implementation to use with Koin (#50) - allow no logging at startKoin of logger is set to EmptyLogger()
[ADDED]
by inject()
function handle parameters to definition (#49)Android Architecture
[FIXED]
fix viewModel extensions rewritten from LifecycleOwner
interface[FIXED]
fix by viewModel()
API to allow use KClass object argument instead of type inference - offers now getViewModelByclass()
and viewModelByClass()
(#56)[ADDED]
by viewModel()
function handle parameters to definition (#49)[ADDED]
by viewModel()
function handle key instance for Android ViewModelFactory (#49)Core
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 the getViewModel()
function and allow val
attribute declaration of your ViewModel
(like with by inject()
) - (issue #37)ViewModel
between Activity and Fragmentsandroid.arch.lifecycle:extensions
updated to 1.1.0
Spark
startSpark {}
has been renamed to start {}
and have a modules
arguments to list all of your modulesstart()
and startKoin
has been merged to start( modules = <List of modules>)
stopSpark{}
has been renamed to stop {}
and include closeKoin()
Core
1.2.21
Android Architecture
viewModel
DSL keyword (specialized provide
alias for ViewModel), to declare an Architecture Components ViewModelgetViewModel()
function in Activities and Fragments, to get and bind ViewModel componentsSpark
controller {}
DSL keyword (specialized provide
alias), 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 with controller
keyword DSLCore
Kotlin compilation has been updated to 1.1.61
Core
Module
class. Now use directly the applicationContext
functionPrintLogger
instead of EmptyLogger
provide
aliases with bean
and factory
bind
keyword)startKoin()
Android
AndroidLogger
instead of EmptyLogger
AndroidModule
, just use applicationContext
to declare a moduleandroidApplication()
is a DSL extension to provide Android Application
resolution (can also be done with get<Application>()
)Samples
Core
startKoin()
is now part of standAloenContextcloseKoin()
now close actual Koin contextKoinComponent
has get()
and getProperty()
Android
starKoin()
functionSamples
Ktor
The target of this release was to simplify and make clearer the syntax of Koin.
DSL
getProperties
can now have a default valueCore
Stand alone complex & KoinComponent have been reviewed
renamed startContext functions to startKoin()
KoinComponent
Koin can load properties from koin.properties file or system properties
startKoin()
have now a properties
parameter to give additional properties at startup
getKoin()
!KoinTest
KoinComponent
dryRun()
is usable in a Kointest component, after a startKoin
Android
bindProperty()
renamed to setProperty()
startAndroidContext()
has been renamed to startKoin()
Core
getProperty()
can provide a default value if key property is missingprovide()
can be use on a KoinContext directly, to declare on componentAndroid
applicationContext
has been renamed androidApplication
Core
Android
Tests
javadoc is now generated with Dokka
Core
startContext
function to start a Koin contextkoinContext.removeProperties()
remove properties by their keysAndroid
startAndroidContext
function to start an Android Koin contextKoinContextAware
interfaces have been removedby inject
and by property
ContextAwareActivity
& ContextAwareFragment
are components to help you automatically release contexts - don't hesitate to do it manuallyTests
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
declareContext{}
has been renamed applicationContext{}
, and behind gives a better idea that you are describing your application context (the root context of your app)modulePath(){}
has been dropped for context(){}
- context describes a sub context of your application, has a a name and can have also sub context itself (sub contexts are hierarchical)bind{}
doesn't need lambda anymore to declare your bound class, but just the class in argument: bind()
provideFactory
is a DSL keyword to provide a factory definition instead of singletonCore
KoinContext.release()
is now called with context's name, no owner class instanceKoinContext.dryRun()
help to run your modules and check if every dependency can be injectedSample App & Android
Core
Android
Sample App
Core
DSL
Android
Sample App
Koin & Koin-Android project has meen merged
DSL
context()
function implementation, to return a Context object. The declareContext
function unlock the Koin DSL to describe dependencies and injection:class MykModule : Module() {
override fun context() = declareContext { ... }
}
class MykModule : Module() {
override fun context() = declareContext {
provide { Processor() } bind { ProcessorInterface::class}
}
}
Scope
modulePath {}
operator. See paths sectionrelease()
on a KoinContextclass 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 Fragmentclass MainActivity : AppCompatActivity() {
// inject my WeatherService
val weatherService by inject<WeatherService>()
}
Koin
// fill applicationContext for Koin context
val ctx = Koin().init(applicationContext).build(Module1(),Module2()...)
Internal rework for simpler use with Scopes:
Koin().build()
return KoinContextrelease()
Scope operation此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。