Skip to content

Instantly share code, notes, and snippets.

View Shamyyoun's full-sized avatar

Mahmoud Elshamy Shamyyoun

View GitHub Profile
@Shamyyoun
Shamyyoun / BaseViewModel.kt
Created March 30, 2026 15:14
Base MVI (Model-View-Intent) contract for Jetpack Compose or Compose Multiplatform + Kotlin Coroutines
package com.core.ui.mvi
import androidx.compose.runtime.MutableState
import androidx.compose.runtime.State
import androidx.compose.runtime.mutableStateOf
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.receiveAsFlow