Last active
March 31, 2026 02:27
-
-
Save skydoves/57d27bca567a4eb85e261a214383cb73 to your computer and use it in GitHub Desktop.
Compose HotSwan - Non-composable function hot reload
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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