GithubHelp home page GithubHelp logo

reloni / rxdataflow Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 491 KB

Unidirectional Data Flow in Swift - Inspired by ReSwift

License: MIT License

Swift 99.93% Shell 0.07%
swift rxswift reactive unidirectional

rxdataflow's Introduction

RxDataFlow

Build Status codecov Platform iOS Carthage compatible codebeat badge

Introduction

RxDataFlow is another implementation of unidirectional data flow architecture. This library is inspired by ReSwift (which was inspired by Redux).

More information will be added soon:)

Components

  • State: A data structure that describes state of application.
  • Reducer: A pure function that creates new state on base on action and current state.
  • Action: Actions describe state change. Reducer produce state changes according to dispatched action.

  1. The View Controller/View Model creates an Action and dispatch it to the FlowController.

  2. The FlowController switches to appropriate scheduler and sends the State and Action to the Reducer.

  3. The Reducer receives the current App State and the dispatched Action, computes and returns new State.

  4. The FlowController saves new State and sends it to the subscribers.

  • In case of an error FlowController doesn't change State and sends Error to all subscribers instead.
  • It's possible to setup special FallbackAction that will be dispatched in case of an error (see CompositeAction).
  1. Subscriber receives new State and operate accordingly: View Model may transform State, View Controller may directly bind data to the UI.

Dispatch rules

FlowController dispatches actions in internal SerialDispatchQueueScheduler (so all operations are asynchronous by default), all incoming actions first get in the queue and dispatches (Reducer get executed with current State and Action instances) one after another. For example if you dispatches three actions and every action requires network request - requests will not get fired simultaneously, but one after another.

Dependencies

Requirements

  • Xcode 10.0
  • Swift 5.0

Installation

github "reloni/RxDataFlow"

Example Projects

SimpleToDo - kind of "real world" app using this architecture, already in app store.

Credits

List of similar projects:

rxdataflow's People

Contributors

reloni avatar

Stargazers

 avatar  avatar

Watchers

 avatar

rxdataflow's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.