Koin integration
To use the getScreenModel you should first import cafe.adriel.voyager:voyager-koin (see Setup).
Declare your ScreenModels using the factory component.
1
val homeModule = module {
2
factory { HomeScreenModel() }
3
}
Copied!
Call getScreenModel() to get a new instance.
1
class HomeScreen : Screen {
2
3
@Composable
4
override fun Content() {
5
val screenModel = getScreenModel<HomeScreenModel>()
6
// ...
7
}
8
}
Copied!

Sample

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