GitHub
Discussions
Change Log
License
Search…
Overview
Setup
Navigation
ScreenModel
Coroutines integration
RxJava integration
LiveData integration
Koin integration
Kodein integration
Hilt integration
Android ViewModel
Stack API
State restoration
Transitions
Lifecycle
Back press
Deep links
Powered By
GitBook
Koin integration
To use the
getScreenModel
you should first import
cafe.adriel.voyager:voyager-koin
(see
Setup
).
Declare your
ScreenModel
s 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
.
Previous
LiveData integration
Next
Kodein integration
Last modified
1mo ago
Copy link
Contents
Sample