Created
April 28, 2020 18:54
-
-
Save oradkovsky/a6d0cd645303496f7df053e0a9085580 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// declare view model | |
class MyViewModel(private val gson: Gson) : ViewModel() { | |
//... | |
} | |
// modify corresponding module | |
val viewModelsModule = module { | |
viewModel { MyViewModel(get()) } | |
} | |
// make use of it! | |
// extension function is in use: org.koin.androidx.viewmodel.ext.android | |
class MyFragment : Fragment() { | |
private val myViewModel: MyViewModel by viewModel() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment