Latest 2.0.1
License MIT
Platforms ios 8.0, osx 10.9, watchos 2.0, tvos 9.0, requires ARC


Carthage compatible
Swift Package Manager


Yet another Redux written in Swift


Swift Package Manager

Add this repo as a dependency in your Package.swift file, for example:

import PackageDescription

let package = Package(
    name: "Example",
    dependencies: [
        .Package(url: "",
                 majorVersion: 2),


github "NicholasTD07/TDRedux.swift" ~> 2.0


pod 'TDRedux.swift', '~> 2.0'



A Store holds a State. A State is the entire internal state of an application, which could be anything.

You can

  • create a Store with a Reducer
  • dispatch Actions to change a Store‘s State
  • subscribe to changes happens to the State of a Store

Read more: Redux in Swift Part 1 – Store and State

Reducer Type

A Reducer is a function which takes an optional State and an Action and returns a new State, defined as the following:

class Store<State> {
    typealias Reducer = (State?, Action) -> State

Read more: Redux in Swift Part 1 – Reducer and Action


An Action describes what happened while it may carry some data, e.g. AddTodo(text: "buy milk") or ToggleTodo(atIndex: 1)

Action type is defined as

typealias Action = Any

Read more: Redux in Swift Part 1 – Reducer and Action

Reducer function

A helper function which wraps Reducers that take non-optional State and specific type of Action, so that: No more type-casting in hand written Reducers anymore. For example:

typealias CounterState = Int

enum CounterActions {
  case increase
  case decrease

let counterReducer: (CounterState, CounterActions) = /* ... */
let wrappedReducer: (CounterState?, Any) = Reducer(initialState: 0, reducer: counterReducer)

let counterStore = Store<CounterState>.init(with: wrappedReducer)


A helper function which combines an array of Reducers into one. For example:

typealias State = /* ... */
let arranOfReducers: [(State?, Any)] = [ /* ... */ ]
let combinedReducers: (State?, Any) = combineReducers(arranOfReducers)


It provides a third-party extension point between dispatching an action, and the moment it reaches the reducer.

Redux doc: Middleware

What’s Experimental?

Everything in Store is final

Store and every property and methods in Store are defined as final.

Let me know if you think the Store need to be subclassed and overridden.


I am not too familiar with this concept in Redux and also I am not sure whether there are potential issues in my implementation or not.


TDRedux is released under the MIT license. See LICENSE for details.

Read More

Latest podspec

    "name": "TDRedux.swift",
    "version": "2.0.1",
    "summary": "Yet another Redux written in Swift",
    "description": "TDRedux.swift is a micro framework which helps you buildnapps with the Redux architecture.nI wrote it because it is fun and easy to write your own Redux.",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "NicholasTD07": "[email protected]"
    "social_media_url": "",
    "module_name": "TDRedux",
    "platforms": {
        "ios": "8.0",
        "osx": "10.9",
        "watchos": "2.0",
        "tvos": "9.0"
    "source": {
        "git": "",
        "tag": "2.0.1"
    "source_files": [
    "requires_arc": true,
    "pushed_with_swift_version": "3.0"

Pin It on Pinterest

Share This