Skip to content

Instantly share code, notes, and snippets.

@phdesign
Created March 18, 2025 09:14
Show Gist options
  • Save phdesign/675825973328afc49c190df7967a1346 to your computer and use it in GitHub Desktop.
Save phdesign/675825973328afc49c190df7967a1346 to your computer and use it in GitHub Desktop.
Holding a reference to a composable in Kotlin
val icon: @Composable () -> Unit = if (isMatch) {
{
Icon(
imageVector = Icons.Outlined.CheckCircle,
contentDescription = "DNS location matches your IP",
)
}
} else {
{
Icon(
imageVector = Icons.Outlined.ErrorOutline,
contentDescription = "DNS location does not match your IP",
)
}
}
...
{ icon() }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment