-
public abstract class BaseViewModel<STATE extends BaseState, EVENT extends BaseEvent, EFFECT extends BaseEffect, ERROR extends BaseError> extends ViewModel
UI 내 state, event, effect를 처리하기 위한 MVI 구조의 뷰 모델 아키텍처
-
-
Field Summary
Fields Modifier and Type Field Description private final StateFlow<STATE>stateprivate final StateFlow<ScreenState>screenStateprivate final StateFlow<UiState>uiStateprivate final SharedFlow<ERROR>errorprivate final Flow<EVENT>eventprivate final SharedFlow<EFFECT>effectprivate final Function1<EVENT, Unit>onEvent
-
Constructor Summary
Constructors Constructor Description BaseViewModel()
-
Method Summary
Modifier and Type Method Description final StateFlow<STATE>getState()final StateFlow<ScreenState>getScreenState()screenState현재 화면 상태 final StateFlow<UiState>getUiState()screenState현재 화면의 UI 상태 final SharedFlow<ERROR>getError()final Flow<EVENT>getEvent()final SharedFlow<EFFECT>getEffect()final Function1<EVENT, Unit>getOnEvent()final <ERROR CLASS>bindError(CoroutineScope scope, SuspendFunction1<ERROR, Unit> action)bindError에러 플로우를 관측합니다. final <ERROR CLASS>bindEvent(CoroutineScope scope, SuspendFunction1<EVENT, Unit> action)bindEvent이벤트 플로우를 관측합니다Event 에 대한 동작을 구현하여 적용합니다. final <ERROR CLASS>bindEffect(CoroutineScope scope, SuspendFunction1<EFFECT, Unit> action)bindEvent이펙트 플로우를 관측합니다Effect 에 대한 동작을 구현하여 적용합니다. -
-
Method Detail
-
getScreenState
final StateFlow<ScreenState> getScreenState()
현재 화면 상태
-
getUiState
final StateFlow<UiState> getUiState()
현재 화면의 UI 상태
-
getOnEvent
final Function1<EVENT, Unit> getOnEvent()
-
bindError
final <ERROR CLASS> bindError(CoroutineScope scope, SuspendFunction1<ERROR, Unit> action)
-
bindEvent
final <ERROR CLASS> bindEvent(CoroutineScope scope, SuspendFunction1<EVENT, Unit> action)
-
bindEffect
final <ERROR CLASS> bindEffect(CoroutineScope scope, SuspendFunction1<EFFECT, Unit> action)
-
-
-
-