ScopeViewModel

abstract class ScopeViewModel : ViewModel, KoinScopeComponent

Class to help support Koin Scope in a ViewModel create directly a scope instance for current ViewModel

allow to intercept before scope closing with onCloseScope, to be overriden

Destroy linked scope with ViewModelScopeAutoCloseable

Author

Arnaud Giuliani

See also

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
open override val scope: Scope

Functions

Link copied to clipboard
expect open fun addCloseable(closeable: AutoCloseable)
expect fun addCloseable(key: String, closeable: AutoCloseable)
Link copied to clipboard
expect fun <T : AutoCloseable> getCloseable(key: String): T?
Link copied to clipboard
open fun getKoin(): Koin
Link copied to clipboard
open fun onCloseScope()

To override to add behavior before closing Scope

Link copied to clipboard
fun KoinScopeComponent.viewModelScope(): Scope

Create a ViewModel Scope as ViewModelScope archetype for given ViewModel