Release 0.11.0 (23)
Note: This release contains significant breaking changes from previous versions.
- Updated Kotlin to version
1.8.20
- Updated Compose Multiplatform to version
1.4.0
- Updated other dependencies
- Renamed project from
presentation
tocycle
- Foundational changes in components and structure
- Simplification of API
New API is compatible with Redux, MVI, and MVVM:
fun counterReducer(state: Int?, change: CounterChange): Int {
val value = state ?: 0
return when (change) {
CounterChange.INCREMENT -> value + 1
CounterChange.DECREMENT -> value - 1
}
}
@Composable
fun Counter(viewModel: ViewModel<Int, CounterChange> = ViewModel.create(reducer = ::counterReducer)) {
val state by viewModel.stateChanges()
Text("Count = $state")
LaunchedEffect(Unit) {
viewModel.dispatch(CounterChange.INCREMENT) // 1
viewModel.dispatch(CounterChange.INCREMENT) // 2
viewModel.dispatch(CounterChange.DECREMENT) // 1
}
}
Full Changelog: 0.10.0...0.11.0