add docs to the MutableState.asState

This commit is contained in:
2023-01-29 12:46:27 +06:00
parent 03de71df2e
commit cd73791b6f
2 changed files with 7 additions and 1 deletions

View File

@@ -1,6 +1,10 @@
package dev.inmo.micro_utils.common.compose
import androidx.compose.runtime.MutableState
import androidx.compose.runtime.State
import androidx.compose.runtime.derivedStateOf
fun <T> MutableState<T>.asState() = derivedStateOf { this.value }
/**
* Converts current [MutableState] to immutable [State] using [derivedStateOf]
*/
fun <T> MutableState<T>.asState(): State<T> = derivedStateOf { this.value }