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
1. Main one - ViewModel | |
NAME: MVI BaseViewModell | |
FILE NAME: BaseViewModel | |
EXTENSION: kt | |
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME} #end | |
import androidx.lifecycle.ViewModel | |
import androidx.lifecycle.viewModelScope |
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
1. Main one - ViewModel | |
NAME: MVI Fragment Screen with ViewModel | |
FILE NAME: ${NAME}ViewModel | |
EXTENSION: kt | |
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME} #end | |
import ${PACKAGE_NAME}.${NAME}Action | |
import ${PACKAGE_NAME}.${NAME}State |
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
1. MVI BaseViewModel (mviBaseVm) -Creates an abstract class for MVI BaseViewModel; Reuqires UiAction and UiEvent marker interfaces: | |
import androidx.lifecycle.ViewModel | |
import androidx.lifecycle.viewModelScope | |
import kotlinx.coroutines.channels.Channel | |
import kotlinx.coroutines.flow.MutableStateFlow | |
import kotlinx.coroutines.flow.SharingStarted | |
import kotlinx.coroutines.flow.onStart | |
import kotlinx.coroutines.flow.receiveAsFlow | |
import kotlinx.coroutines.flow.stateIn |