All Projects → gumil → Kaskade

gumil / Kaskade

Licence: apache-2.0
[INACTIVE] Simplifying state management

Programming Languages

kotlin
9241 projects
flow
126 projects

Projects that are alternatives of or similar to Kaskade

Hal
🔴 A non-deterministic finite-state machine for Android & JVM that won't let you down
Stars: ✭ 63 (-71.75%)
Mutual labels:  coroutines, machine, state
Keemun
No description or website provided.
Stars: ✭ 13 (-94.17%)
Mutual labels:  coroutines, multiplatform, unidirectional-data-flow
Coroutineworker
Kotlin Coroutine-based workers for native
Stars: ✭ 282 (+26.46%)
Mutual labels:  coroutines, multiplatform
Oolong
MVU for Kotlin Multiplatform
Stars: ✭ 248 (+11.21%)
Mutual labels:  coroutines, multiplatform
StateMachine system for Godot
Flexible and lightweight StateMachine for Godot
Stars: ✭ 19 (-91.48%)
Mutual labels:  machine, state
Stent
Stent is combining the ideas of redux with the concept of state machines
Stars: ✭ 681 (+205.38%)
Mutual labels:  machine, state
compose-actors
🤖 Android app built with jetpack 🚀 compose follows new revamped guide to app architecture. Implemented with State, Coroutines ➰, ViewModels, Repository pattern, Light/Dark theme 🌈 MD3, Animations, Draw on canvas, Custom layouts, UI state handling, 🌀 Image loading with coil, Palette 🎨 usage and dynamic theming etc.
Stars: ✭ 80 (-64.13%)
Mutual labels:  coroutines, state
Machinery
State machine thin layer for structs (+ GUI for Phoenix apps)
Stars: ✭ 367 (+64.57%)
Mutual labels:  machine, state
Uniflow Kt
Uniflow 🦄 - Simple Unidirectional Data Flow for Android & Kotlin, using Kotlin coroutines and open to functional programming
Stars: ✭ 414 (+85.65%)
Mutual labels:  coroutines, unidirectional-data-flow
Ccc
💰 Currency Converter Calculator with power of Kotlin Multiplatform
Stars: ✭ 109 (-51.12%)
Mutual labels:  coroutines, multiplatform
State
Finite state machine for TypeScript and JavaScript
Stars: ✭ 118 (-47.09%)
Mutual labels:  machine, state
Vertx Lang Kotlin
Vert.x for Kotlin
Stars: ✭ 215 (-3.59%)
Mutual labels:  coroutines
Flooks
🍸 A state manager for React Hooks
Stars: ✭ 201 (-9.87%)
Mutual labels:  state
Knot
Unidirectional reactive state container for Android & Kotlin
Stars: ✭ 198 (-11.21%)
Mutual labels:  unidirectional-data-flow
Paco
Small utility library for coroutine-driven asynchronous generic programming in Python 3.4+
Stars: ✭ 198 (-11.21%)
Mutual labels:  coroutines
Machine Learning For Learning Resources
This ebook from Jason Brownlee. Educational perpose only! Thanks to Jason for the books.
Stars: ✭ 221 (-0.9%)
Mutual labels:  machine
Web Dev Tools Android
Sample Android Application - MVVM, Clean Architecture, Modularization, Repository Pattern
Stars: ✭ 215 (-3.59%)
Mutual labels:  coroutines
Wanandroid
Kotlin+JetPack+协程实现的MVVM架构Wanandroid客户端
Stars: ✭ 197 (-11.66%)
Mutual labels:  coroutines
Call in stack
Call a function in a new stack that allocated anywhere. Do not be afraid of stack limit in your coroutines! Try to make your stack shareable between all coroutines!
Stars: ✭ 197 (-11.66%)
Mutual labels:  coroutines
Tsf
coroutine and Swoole based php server framework in tencent
Stars: ✭ 2,204 (+888.34%)
Mutual labels:  coroutines

Kaskade

Build Status Download Android Arsenal codecov Codacy Badge

State Container for Kotlin and Android.

The name comes from cascade, a waterfall, which reflects the objective of the library to make flows easier with unidirectional data flow.

Inspired by MVI or Model View Intent.

Kaskade

Why Kaskade?

  • Lightweight - enforces unidirectional data flow without the use of external dependencies.
  • Modular - can be easily substituted to different implementation with or without the use of another library.
  • Extendable - in relation to modular and lightweight, it's important to extend the API and create user defined implementation to fit specific requirements.
  • Unidirectional - data flows in one direction.
  • Predictable - control on state changes and action triggers.
  • DSL - able to hide complexity in a fluent way.
  • Multiplatform - built for JVM, iOS, and Javascript.

Installation

  1. Add to settings.gradle
enableFeaturePreview('GRADLE_METADATA')
  1. Add the dependency
dependencies {
  // core module
  implementation 'dev.gumil.kaskade:core:0.x.y'
  // coroutines module
  implementation 'dev.gumil.kaskade:coroutines:0.x.y'
  // rx module
  implementation 'dev.gumil.kaskade:rx:0.x.y'
  // livedata module
  implementation 'dev.gumil.kaskade:livedata:0.x.y'
}

(Please replace x and y with the latest version numbers: Download )

Usage

Create the Action and State objects.

Note: objects are only used here for simplicity in real projects data classes are more appropriate

internal sealed class TestState : State {
    object State1 : TestState()
    object State2 : TestState()
    object State3 : TestState()
}

internal sealed class TestAction : Action {
    object Action1 : TestAction()
    object Action2 : TestAction()
    object Action3 : TestAction()
}

Create Kaskade with TestState.State1 as initial state

val kaskade = Kaskade.create<TestAction, TestState>(TestState.State1) {
    on<TestAction.Action1> {
        TestState.State1
    }

    on<TestAction.Action2> {
        TestState.State2
    }

    on<TestAction.Action3> {
        TestState.State3
    }
}

Adding actions to Action with parameter ActionState

on<TestAction.Action1> { actionState ->
    // do any side effects when returning a new state
    TestState.State1
}

Observing states

kaskade.onStateChanged = {
    // Do something with new state
    render(it)
}

Observing states with Emitter

kaskade.stateEmitter().subscribe {
    // Do something with new state
    render(it)
}

Executing actions

kaskade.dispatch(TestAction.Action1)

Documentation

Check out the wiki for documentation.

Some of the topics covered are:

Sample projects

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].