A Cross-Platform ViewModel Base
Hold state and a scope that both platforms can use.
Why Share the ViewModel?
A ViewModel holds screen state and logic. In KMP you write it once in shared code so both apps stay perfectly in sync. 🎉
Logic, Not Pixels
Your shared ViewModel decides what the screen shows. The native UI decides how to draw it. That split is the heart of KMP.
All lessons in this course
- A Cross-Platform ViewModel Base
- Expose UI State as StateFlow
- Handle User Intents & Actions
- Bind the ViewModel to Each UI