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:)
- 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.
-
The
View Controller/View Model
creates anAction
and dispatch it to theFlowController
. -
The
FlowController
switches to appropriate scheduler and sends theState
andAction
to theReducer
. -
The
Reducer
receives the currentApp State
and the dispatchedAction
, computes and returns newState
. -
The
FlowController
saves newState
and sends it to the subscribers.
- In case of an error
FlowController
doesn't changeState
and sendsError
to all subscribers instead. - It's possible to setup special
FallbackAction
that will be dispatched in case of an error (see CompositeAction).
- Subscriber receives new
State
and operate accordingly:View Model
may transformState
,View Controller
may directly bind data to the UI.
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.
- RxSwift >= 5.0.1
- Xcode 10.0
- Swift 5.0
- Using Carthage
github "reloni/RxDataFlow"
SimpleToDo - kind of "real world" app using this architecture, already in app store.
List of similar projects: