# transform

Common/All

## Functions summary

|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/runtime/State<R>` | `@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable <R : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/appstate/transform/transform.composable#transform(kotlin.Any,kotlinx.coroutines.CoroutineDispatcher,kotlin.Function1)( initialValue: R, dispatcher: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-dispatcher/index.html, onUpdate: @https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable (R) -> R )` A Composable `https://developer.android.com/reference/kotlin/androidx/appstate/transform/transform.composable#transform(kotlin.Any,kotlinx.coroutines.CoroutineDispatcher,kotlin.Function1)` that remembers the resulting `https://developer.android.com/reference/kotlin/androidx/compose/runtime/State` and ties the headless composition to the current `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-scope/index.html` provided by the Compose lifecycle. | Cmn |

## Functions

### transform

Cmn Artifact: [androidx.appstate.transform:transform](https://developer.android.com/jetpack/androidx/releases/appstate-transform) [View Source](https://cs.android.com/search?q=file:androidx/appstate/transform/Transform.kt+function:transform)

```
@Composable
fun <R : Any?> transform(
    initialValue: R,
    dispatcher: CoroutineDispatcher = Dispatchers.Default,
    onUpdate: @Composable (R) -> R
): State<R>
```

A Composable `https://developer.android.com/reference/kotlin/androidx/appstate/transform/transform.composable#transform(kotlin.Any,kotlinx.coroutines.CoroutineDispatcher,kotlin.Function1)` that remembers the resulting `https://developer.android.com/reference/kotlin/androidx/compose/runtime/State` and ties the headless composition to the current `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-scope/index.html` provided by the Compose lifecycle.

| Parameters |
|---|---|
| `initialValue: R` | The initial value to populate the returned `https://developer.android.com/reference/kotlin/androidx/compose/runtime/State` before the first composition completes. |
| `dispatcher: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-dispatcher/index.html = Dispatchers.Default` | The `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-dispatcher/index.html` thread this transform should run on. |
| `onUpdate: @https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable (R) -> R` | The `https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable` block that computes the value of type `https://developer.android.com/reference/kotlin/androidx/appstate/transform/package-summary#transform(kotlin.Any,kotlinx.coroutines.CoroutineDispatcher,kotlin.Function1)`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/runtime/State<R>` | A `https://developer.android.com/reference/kotlin/androidx/compose/runtime/State` containing the latest result of the `https://developer.android.com/reference/kotlin/androidx/appstate/transform/transform.composable#transform(kotlin.Any,kotlinx.coroutines.CoroutineDispatcher,kotlin.Function1)` block. |