Slide 30
Slide 30 text
AbemaTV, Inc. All Rights Reserved
buildUiModel()ͷఆٛ
Single Source of Truth(SSoT)ΛͲ͏͔ͬͨ
10
fun ViewModel.buildUiModel(
flow: StateFlow,
flow2: StateFlow,
flow3: StateFlow,
transform: (T1, T2, T3) -> R,
): StateFlow = combine(
flow = flow,
flow2 = flow2,
flow3 = flow3,
transform = transform
).stateIn(
scope = viewModelScope,
started = SharingStarted.WhileSubscribed(5_000),
initialValue = transform(
flow.value, flow2.value, flow3.value
)
)