Releases: chRyNaN/cycle
Releases · chRyNaN/cycle
Release 0.11.1 (24)
This is a hotfix release from version 0.11.0 (23). Refer to the 0.11.0 (23) release for more information about this release.
Fixes
- Fixed iOS build
Full Changelog: 0.11.0...0.11.1
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
Release 0.10.0 (22)
- Created
MutableStateStore
interface - Created
ViewModelFlowScope
interface - Added
resetOnUnbind
property toViewModel
class - Updated Kotlin to version
1.7.20
- Updated compose-jb to version
1.3.0-beta03
- Updated other dependencies
- Created
ViewModelProvider
and updatedViewModelFactory
and changed its focus - Created
ComposeLayout
function - Created
LocalViewModelProvider
providable composition local for Jetpack Compose - Created
rememberViewModel
function for Jetpack Compose
Full Changelog: 0.9.0...0.10.0
Release 0.9.0 (21)
- Updated Kotlin to version 1.7.10 and compose-jb to version 1.2.0-beta01
- Added iOS and JS support to the
presentation-compose
module - Made
renderState
andisBound
propertiesfinal
in theLayout
class - Renamed
BaseViewModel
toPlatformViewModel
Full Changelog: https://github.com/chRyNaN/presentation/compare/0.8.0...0.9.0###
Release 0.8.0 (20)
- Updated Kotlin to version
1.7.0
- Updated compose-jb to version
1.2.0-alpha01-dev755
Full Changelog: 0.7.4...0.8.0
Release 0.7.4 (19)
- Renamed
ViewModel
toBaseViewModel
and made its constructorinternal
- Renamed
BasePresenter
toViewModel
- Renamed
PresenterFactory
toViewModelFactory
- Library now uses more of a "ViewModel" approach to the communication channel between the
View
and the other design pattern components, instead of the previous "Presenter" approach. This removes a cyclic dependence between theView
and the Presenter/ViewModel component.- Previously, the
BasePresenter
had a reference to theView
, and theView
had a reference to thePresenter
. This was needed so that thePresenter
could call theView.render
function with the new derived State, and so theView
could emit intents to the Presenter. This was later abstracted, by having theBasePresenter
only take aFlow<Intent>
instead of aView
, so that there would be no direct reference to the View. These approaches required aPresenterFactory
to simplify the creation of a Presenter, and inject the View it was bound to. - Now, only the
View
has a reference to theViewModel
(previously BasePresenter). TheView
emits intents by calling theViewModel.intent
function. And theView
subscribes to State changes via theViewModel.renderStates
property. This way there is no cyclic dependency requirement between the two components.
- Previously, the
- Created
View.intent
extension function for convenience that just delegates to theViewModel.intent
function.
New usage of the library would look like the following:
class HomeLayout : Layout<HomeIntent, HomeState, HomeChange>() {
override val viewModel = ViewModel<I, S, C>(
perform = { intent, state -> ... },
reduce = { state, change -> ... })
@Composable
override fun Content() {
val state by stateChanges()
Text("State = $state")
}
override fun onBind() {
intent(to HomeIntent.Load())
}
}
Full Changelog: 0.7.3...0.7.4
Release 0.7.3 (18)
- Updated
Layout.Content
function to not take a state parameter and addedstateChanges()
function.- This provides more control over the states to be rendered
- New usage would look like the following:
@Composable
override fun Content() {
val state by stateChanges()
Text("state = $state")
}
Full Changelog: 0.7.2...0.7.3
Release 0.7.2 (17)
- Updated dependencies
- Added support for iOS Simulator Arm64 targets
- Created
FlatMapStrategy
and addedstrategy
parameter toperform
andperformWith
functions in `BasePresenter - Created
IntentEvent
model - Removed
states
property fromView
interface - Removed
BasePresentationActivity
- Updated
BasePresentationFragment
- Renamed
BasePresentationFragment
toPresentationFragment
- Created
ComposeFragment
- Removed
BasePresenterFactory
Full Changelog: 0.7.1...0.7.2
Release 0.7.1 (16)
- Fixed presenter retention issue with
presenterFactory
delegate functions
Release 0.7.0 (15)
- Removed the direct tight-coupling between a
View
and aPresenter
. Now, aPresenter
only has anintents
property instead of aview
property. Even though the intents typically come from aView
, this is not mandatory. This allows for better decoupling and flexibility for the components. - Renamed the
Layout.OnLayout
composable function toLayout.Content
. This follows a more similar approach to function naming with Jetpack Compose and the Android community Jetpack Compose libraries. - Renamed the
composeLayout
function toComposeLayout
so that it follows the capitalization approach of Compose functions. - Removed overloaded
composeLayout
functions, to avoid confusion between thelayout
and newComposeLayout
functions responsibilities. - Replaced the
Layout.presenterFactory
property withLayout.presenter
and createdpresenterFactory
delegate functions. This is a more flexible approach as it allows direct instantiation of a Presenter or delegation to injection or aPresenterFactory
. - Created more convenience
Presenter
constructor functions to reduce the boilerplate code needed to create aPresenter
for simple use-cases. - Upgraded Kotlin to version
1.6.10
. - Upgraded the
compose-gradle-plugin
to1.0.1
. - Upgraded other dependencies.