Skip to content

Releases: chRyNaN/cycle

Release 0.11.1 (24)

14 Apr 16:54
Compare
Choose a tag to compare

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)

14 Apr 13:56
Compare
Choose a tag to compare

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 to cycle
  • 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)

25 Nov 23:01
Compare
Choose a tag to compare
  • Created MutableStateStore interface
  • Created ViewModelFlowScope interface
  • Added resetOnUnbind property to ViewModel class
  • Updated Kotlin to version 1.7.20
  • Updated compose-jb to version 1.3.0-beta03
  • Updated other dependencies
  • Created ViewModelProvider and updated ViewModelFactory 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)

08 Oct 14:42
Compare
Choose a tag to compare
  • 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 and isBound properties final in the Layout class
  • Renamed BaseViewModel to PlatformViewModel

Full Changelog: https://github.com/chRyNaN/presentation/compare/0.8.0...0.9.0###

Release 0.8.0 (20)

20 Aug 18:53
Compare
Choose a tag to compare
  • 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)

15 May 18:01
Compare
Choose a tag to compare
  • Renamed ViewModel to BaseViewModel and made its constructor internal
  • Renamed BasePresenter to ViewModel
  • Renamed PresenterFactory to ViewModelFactory
  • 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 the View and the Presenter/ViewModel component.
    • Previously, the BasePresenter had a reference to the View, and the View had a reference to the Presenter. This was needed so that the Presenter could call the View.render function with the new derived State, and so the View could emit intents to the Presenter. This was later abstracted, by having the BasePresenter only take a Flow<Intent> instead of a View, so that there would be no direct reference to the View. These approaches required a PresenterFactory to simplify the creation of a Presenter, and inject the View it was bound to.
    • Now, only the View has a reference to the ViewModel (previously BasePresenter). The View emits intents by calling the ViewModel.intent function. And the View subscribes to State changes via the ViewModel.renderStates property. This way there is no cyclic dependency requirement between the two components.
  • Created View.intent extension function for convenience that just delegates to the ViewModel.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)

09 May 02:03
Compare
Choose a tag to compare
  • Updated Layout.Content function to not take a state parameter and added stateChanges() 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)

26 Mar 20:22
Compare
Choose a tag to compare
  • Updated dependencies
  • Added support for iOS Simulator Arm64 targets
  • Created FlatMapStrategy and added strategy parameter to perform and performWith functions in `BasePresenter
  • Created IntentEvent model
  • Removed states property from View interface
  • Removed BasePresentationActivity
  • Updated BasePresentationFragment
  • Renamed BasePresentationFragment to PresentationFragment
  • Created ComposeFragment
  • Removed BasePresenterFactory

Full Changelog: 0.7.1...0.7.2

Release 0.7.1 (16)

29 Jan 21:24
Compare
Choose a tag to compare
  • Fixed presenter retention issue with presenterFactory delegate functions

Release 0.7.0 (15)

29 Jan 20:37
Compare
Choose a tag to compare
  • Removed the direct tight-coupling between a View and a Presenter. Now, a Presenter only has an intents property instead of a view property. Even though the intents typically come from a View, this is not mandatory. This allows for better decoupling and flexibility for the components.
  • Renamed the Layout.OnLayout composable function to Layout.Content. This follows a more similar approach to function naming with Jetpack Compose and the Android community Jetpack Compose libraries.
  • Renamed the composeLayout function to ComposeLayout so that it follows the capitalization approach of Compose functions.
  • Removed overloaded composeLayout functions, to avoid confusion between the layout and new ComposeLayout functions responsibilities.
  • Replaced the Layout.presenterFactory property with Layout.presenter and created presenterFactory delegate functions. This is a more flexible approach as it allows direct instantiation of a Presenter or delegation to injection or a PresenterFactory.
  • Created more convenience Presenter constructor functions to reduce the boilerplate code needed to create a Presenter for simple use-cases.
  • Upgraded Kotlin to version 1.6.10.
  • Upgraded the compose-gradle-plugin to 1.0.1.
  • Upgraded other dependencies.