-
-
Notifications
You must be signed in to change notification settings - Fork 113
/
HiltModule.kt
27 lines (24 loc) 路 895 Bytes
/
HiltModule.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package cafe.adriel.voyager.sample.hiltIntegration
import cafe.adriel.voyager.core.model.ScreenModel
import cafe.adriel.voyager.hilt.ScreenModelFactory
import cafe.adriel.voyager.hilt.ScreenModelFactoryKey
import cafe.adriel.voyager.hilt.ScreenModelKey
import dagger.Binds
import dagger.Module
import dagger.hilt.InstallIn
import dagger.hilt.android.components.ActivityComponent
import dagger.multibindings.IntoMap
@Module
@InstallIn(ActivityComponent::class)
abstract class HiltModule {
@Binds
@IntoMap
@ScreenModelKey(HiltListScreenModel::class)
abstract fun bindHiltScreenModel(hiltListScreenModel: HiltListScreenModel): ScreenModel
@Binds
@IntoMap
@ScreenModelFactoryKey(HiltDetailsScreenModel.Factory::class)
abstract fun bindHiltDetailsScreenModelFactory(
hiltDetailsScreenModelFactory: HiltDetailsScreenModel.Factory
): ScreenModelFactory
}