Skip to content

Instantly share code, notes, and snippets.

@makorowy
Created November 22, 2020 14:39
Show Gist options
  • Save makorowy/b6a89d1d978703f803f84c56d6c17710 to your computer and use it in GitHub Desktop.
Save makorowy/b6a89d1d978703f803f84c56d6c17710 to your computer and use it in GitHub Desktop.
[BLOG] Example of contract between ViewModel and View
data class ViewState(
val firstName: String,
val lastName: String,
val notificationsChecked: Boolean,
val notificationsEnabled: Boolean
)
sealed class Interaction {
data class NotificationSwitchChanged(val enabled: Boolean) : Interaction()
data class FirstNameChange(val firstName: String) : Interaction()
data class LastNameChange(val lastName: String) : Interaction()
object NotificationSettingButtonClick : Interaction()
object HelpButtonButtonClick : Interaction()
object LogOutButtonClick : Interaction()
object AdvancedSettingsButtonClick : Interaction()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment