From 8af551e8895951a5082a5d2750335713d673f80b Mon Sep 17 00:00:00 2001 From: Arkadii Ivanov Date: Wed, 23 Oct 2024 12:29:53 +0100 Subject: [PATCH] Updated docs --- docs/component/instance-retaining.md | 6 +++++- docs/component/state-preservation.md | 18 ++++++++++++++---- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/docs/component/instance-retaining.md b/docs/component/instance-retaining.md index d7c6dd36b..7cbfdc246 100644 --- a/docs/component/instance-retaining.md +++ b/docs/component/instance-retaining.md @@ -31,7 +31,11 @@ class SomeComponent( } ``` -## Usage example (experimental since version 3.2.0-alpha02) +## Simplified usage example + +!!!warning + + The `retainedInstance` API is experimental since version `3.2.0-alpha02`, stable since `3.2.0`. ```kotlin import com.arkivanov.decompose.ComponentContext diff --git a/docs/component/state-preservation.md b/docs/component/state-preservation.md index 9f8ec52a1..0d030438b 100644 --- a/docs/component/state-preservation.md +++ b/docs/component/state-preservation.md @@ -55,9 +55,13 @@ class SomeStatefulEntity(savedState: State?) : InstanceKeeper.Instance { } ``` -## Usage examples (experimental since version 3.2.0-alpha02) +## Simplified state preservation -```kotlin title="Saving state in a component" +!!!warning + + The `saveable` API is experimental since version `3.2.0-alpha02`. + +```kotlin import com.arkivanov.decompose.ComponentContext import com.arkivanov.essenty.statekeeper.saveable import kotlinx.serialization.Serializable @@ -66,11 +70,17 @@ class SomeComponent(componentContext: ComponentContext) : ComponentContext by co private var state: State by saveable(serializer = State.serializer(), init = ::State) @Serializable // Comes from kotlinx-serialization - private class State(val someValue: Int = 0) + private data class State(val someValue: Int = 0) } ``` -```kotlin title="Saving state of a retained instance" +## Simplified state preservation of a retained instance + +!!!warning + + The `retainedInstance` API is experimental since version `3.2.0-alpha02`, stable since `3.2.0`. + +```kotlin import com.arkivanov.decompose.ComponentContext import com.arkivanov.essenty.instancekeeper.InstanceKeeper import com.arkivanov.essenty.instancekeeper.retainedInstance