Last active
October 20, 2020 22:08
-
-
Save TorkelV/ea127b5e14596545de0556010f50f583 to your computer and use it in GitHub Desktop.
This file contains 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 phraseModule = module { | |
viewModel { PhraseViewModel(get()) } | |
single<PhraseDatabase> { | |
Room.databaseBuilder( | |
get(), | |
PhraseDatabase::class.java, "database-name" | |
).build() | |
} | |
single { PreferenceService(get()) } | |
fun provideDao(db: PhraseDatabase): PhraseDao = db.phraseDao() | |
single<PhraseDao> { provideDao(get()) } | |
} | |
class App : Application() { | |
override fun onCreate() { | |
super.onCreate() | |
startKoin { | |
androidContext(this@App) | |
modules(listOf(phraseModule)) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment