Skip to content

Commit eba3360

Browse files
committed
Add explicit return types
1 parent bec39b1 commit eba3360

File tree

1 file changed

+4
-4
lines changed
  • sample/shared/src/commonMain/kotlin/com/rickclephas/kmp/observableviewmodel/sample/shared

1 file changed

+4
-4
lines changed

sample/shared/src/commonMain/kotlin/com/rickclephas/kmp/observableviewmodel/sample/shared/TimeTravelViewModel.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,30 +13,30 @@ open class TimeTravelViewModel: ViewModel() {
1313
* A [StateFlow] that emits the actual time.
1414
*/
1515
@NativeCoroutinesState
16-
val actualTime = clockTime.map { formatTime(it) }
16+
val actualTime: StateFlow<String> = clockTime.map { formatTime(it) }
1717
.stateIn(viewModelScope, SharingStarted.WhileSubscribed(), "N/A")
1818

1919
private val _travelEffect = MutableStateFlow<TravelEffect?>(viewModelScope, null)
2020
/**
2121
* A [StateFlow] that emits the applied [TravelEffect].
2222
*/
2323
@NativeCoroutinesState
24-
val travelEffect = _travelEffect.asStateFlow()
24+
val travelEffect: StateFlow<TravelEffect?> = _travelEffect.asStateFlow()
2525

2626
/**
2727
* A [StateFlow] that indicates if the [currentTime] is fixed.
2828
* @see startTime
2929
* @see stopTime
3030
*/
3131
@NativeCoroutinesState
32-
val isFixedTime = _travelEffect.map { it is TravelEffect.Fixed }
32+
val isFixedTime: StateFlow<Boolean> = _travelEffect.map { it is TravelEffect.Fixed }
3333
.stateIn(viewModelScope, SharingStarted.WhileSubscribed(), false)
3434

3535
/**
3636
* A [StateFlow] that emits the current time.
3737
*/
3838
@NativeCoroutinesState
39-
val currentTime = combine(clockTime, _travelEffect) { actualTime, travelEffect ->
39+
val currentTime: StateFlow<String> = combine(clockTime, _travelEffect) { actualTime, travelEffect ->
4040
formatTime(actualTime + travelEffect)
4141
}.stateIn(viewModelScope, SharingStarted.WhileSubscribed(), "N/A")
4242

0 commit comments

Comments
 (0)