Marker Interfaces
PulseMVI uses marker interfaces to enforce type safety at the generic level. Each interface has no members — they exist solely to constrain type parameters.
PulseState
kotlin
interface PulseStateMarks a class as the UI state managed by a PulseStore. Implement with a data class so copy() is available for immutable updates.
kotlin
data class CounterState(
val count: Int = 0,
val isLoading: Boolean = false,
) : PulseStatePulseAction
kotlin
interface PulseActionMarks a class as a user intent dispatched to a PulseStore. Implement with a sealed class to enumerate all possible actions exhaustively.
kotlin
sealed class CounterAction : PulseAction {
data object Increment : CounterAction()
data object Decrement : CounterAction()
data class SetValue(val value: Int) : CounterAction()
}PulseEvent
kotlin
interface PulseEventMarks a class as a one-time side effect emitted from a PulseStore to the UI. Implement with a sealed class.
kotlin
sealed class CounterEvent : PulseEvent {
data class ShowMessage(val message: String) : CounterEvent()
data object NavigateBack : CounterEvent()
}PulseBroadcast
kotlin
interface PulseBroadcastMarks a class as a broadcast message delivered by PulseContainer to all registered PulseStore instances. Implement with a sealed class.
kotlin
sealed class AppBroadcast : PulseBroadcast {
data object UserLoggedOut : AppBroadcast()
data class ThemeChanged(val isDark: Boolean) : AppBroadcast()
}