Zhuinden / simple-stack

[ACTIVE] Simple Stack, a backstack library / navigation framework for simpler navigation and state management (for fragments, views, or whatevers).
Apache License 2.0
1.36k stars 76 forks source link

Jetpack ViewModel integration sample #224

Closed Zhuinden closed 3 years ago

Zhuinden commented 4 years ago

Due to the way ktx adds new concepts like the viewModelScope, it would make sense to show how to use ScopedServices to create a scoped service per screen (or shared) that holds a ViewModelStore, implements ViewModelStoreOwner, issues onCleared() in onServiceUnregistered() and therefore basically shows how to combine ViewModel with ScopedServices.

Zhuinden commented 3 years ago

Not really needed, and SavedStateHandle's savedStateProvider is package-internal, it would need integration with a SavedStateRegistry too.

Technically there is no reason to integrate at this time that I know of. But it wouldn't be too hard if a real usecase came up.

But it won't be in these samples as there's no reason to.