Last active
November 26, 2019 20:10
-
-
Save mantisbayne/436f32c3de00826d59e17bfd7a99f420 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
val myModule = module { | |
// singleton | |
single { DataRepository() } | |
// factory for ExampleUseCase, use get() to resolve the constructor | |
factory { ExampleUseCase(get()) } | |
// Define a singleton of type HttpClient ("properties_url" is in Koin properties) | |
single { HttpClient(getProperty("properties_url")) } | |
// viewmodel is used for ExampleViewModel | |
viewModel { ExampleViewModel(get()) } | |
// Room database instance (we will create this later) | |
single { Room.databaseBuilder(get(), AppDatabase::class.java, "example_database").build() } | |
single { get<AppDatabase>().exampleDao() } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment