Skip to content

0.7.1

Latest
Compare
Choose a tag to compare
@github-actions github-actions released this 02 Mar 09:21
· 127 commits to master since this release

kmp-viewmodel-compose

Added kmp-viewmodel-koject and kmp-viewmodel-koject-compose artifacts

  • For more information check out the docs/0.x/viewmodel-koject-compose

  • The Koject dependency are used in kmp-viewmodel-koject-compose: com.moriatsushi.koject:koject-core:1.3.0.

  • New The kmp-viewmodel-koject artifact provides the integration of kmp-viewmodel, kmp-viewmodel-compose and Koject,
    helps us to retrieve ViewModel from the Koject DI container without manually dependency injection.

    @Provides
    @Singleton
    class MyRepository
    
    @Provides
    @ViewModelComponent // <-- To inject SavedStateHandle
    class MyViewModel(
      val myRepository: MyRepository,
      val savedStateHandle: SavedStateHandle,
    ) : ViewModel() {
      // ...
    }
    
    @Composable
    fun MyScreen(
      viewModel: MyViewModel = kojectKmpViewModel(),
    ) {
      // ...
    }

Example, docs and tests