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

Sample

Sample code here.
Copy link