Skip to content

Instantly share code, notes, and snippets.

@skydoves
Last active March 31, 2026 02:27
Show Gist options
  • Select an option

  • Save skydoves/57d27bca567a4eb85e261a214383cb73 to your computer and use it in GitHub Desktop.

Select an option

Save skydoves/57d27bca567a4eb85e261a214383cb73 to your computer and use it in GitHub Desktop.
Compose HotSwan - Non-composable function hot reload
class ProfileViewModel : ViewModel() {
// add a new function in your ViewModel
fun formatDisplayName(user: User): String {
// Change the formatting logic and save
return "${user.firstName} ${user.lastName}"
}
}
@Composable
fun MyProfile(viewModel: ProfileViewModel, user: User) {
// hot reload for adding this new composable
Text(text = viewModel.formatDisplayName(user))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment