Skip to content

Instantly share code, notes, and snippets.

@takahirom
Created December 4, 2021 08:46
Show Gist options
  • Save takahirom/b01e859ccc1c0223e5a0b5513c4a4afb to your computer and use it in GitHub Desktop.
Save takahirom/b01e859ccc1c0223e5a0b5513c4a4afb to your computer and use it in GitHub Desktop.
@Composable
fun MySwitch() {
​// MutableState
​val checked = remember { mutableStateOf(false) }
​// ****↓Add****
​println("MySwitch(): $checked")
​// ****↑Add****
​Switch(
​checked = checked.value,
​onCheckedChange = {
​checked.value = it
​}
​)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment