Kodein integration
To use the rememberScreenModel you should first import cafe.adriel.voyager:voyager-kodein (see Setup).
Declare your ScreenModels using the bindProvider bind.
1
val homeModule = DI.Module(name = "home") {
2
bindProvider { HomeScreenModel() }
3
}
Copied!
Call rememberScreenModel() to get a new instance.
1
class HomeScreen : Screen {
2
3
@Composable
4
override fun Content() {
5
val screenModel = rememberScreenModel<HomeScreenModel>()
6
// ...
7
}
8
}
Copied!

Sample

Sample code here.
Last modified 2mo ago
Copy link
Contents
Sample