Skip to content

Commit 9ddff10

Browse files
committed
Update documentation
1 parent 74c4f09 commit 9ddff10

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

docs/state_preservation.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ There are extensions for AndroidX available, they can be used in `Fragments` and
1919

2020
Another use case is to retain an object instance over its scope recreation. This is also commonly used in Android when configuration changes occur. MVIKotlin `keepers` module provides a solution for this as well:
2121

22-
- [InstanceKeeper](https://github.com/arkivanov/MVIKotlin/blob/master/keepers/src/commonMain/kotlin/com/arkivanov/mvikotlin/keepers/instancekeeper/InstanceKeeper.kt) - this interface is used to save and retrieve object instances by key. It has just one method `getOrCreate(key, factory)`, as well as a few handy extension functions. When `getOrCreate` method is called first time, the factory function is called and the returned instance is saved (retained). For any future invocation the retained instance is returned, and the factory function is not invoked.
22+
- [InstanceKeeper](https://github.com/arkivanov/MVIKotlin/blob/master/keepers/src/commonMain/kotlin/com/arkivanov/mvikotlin/keepers/instancekeeper/InstanceKeeper.kt) - this interface is used to save and retrieve object instances by key. It has just one method `get(key, factory)`, as well as a few handy extension functions. When `get` method is called first time, the factory function is called and the returned instance is saved (retained). For any future invocation the retained instance is returned, and the factory function is not invoked.
2323

2424
There is a default implementation available:
2525

@@ -59,7 +59,7 @@ internal class CalculatorStoreFactory(private val storeFactory: StoreFactory) {
5959
class CalculatorController(instanceKeeper: InstanceKeeper) {
6060

6161
private val store: CalculatorStore =
62-
instanceKeeper.getOrCreateStore(::calculatorStore)
62+
instanceKeeper.getStore(::calculatorStore)
6363

6464
/*
6565
* Create a new instance of CalculatorStore.
@@ -76,7 +76,7 @@ class CalculatorController(instanceKeeper: InstanceKeeper) {
7676
class CalculatorController(instanceKeeper: InstanceKeeper) {
7777

7878
private val something: Something =
79-
instanceKeeper.getOrCreate(::Something)
79+
instanceKeeper.get(::Something)
8080

8181
/*
8282
* Instances of this class will be retained.

0 commit comments

Comments
 (0)