You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you landed here, you should also check out the great work over at [ReduxKit](https://github.com/ReduxKit/ReduxKit), which brings the original Redux API to Swift. We all agree that collaboration and sharing of idea's will be beneficial to both projects. Go check it out. Feedback on both projects would be appreciated.
5
+
**This library is a pre-release. Expect missing docs and breaking API changes.**
6
+
7
+
ReSwift is a [Redux](https://github.com/rackt/redux)-like implementation of the unidirectional data flow architecture in Swift. It embraces a unidirectional data flow that only allows state mutations through declarative actions.
8
+
9
+
### Merge announcement:
10
+
11
+
**ReduxKit** and **Swift-Flow** have joined forces! The result is **ReSwift**.
12
+
13
+
_The nitty gritty_: We decided to deprecate [ReduxKit](https://github.com/ReduxKit/ReduxKit) and keep it as a reference implementation of how an almost exact Redux implementation in Swift can be accomplished. It will no longer be actively maintained, but PRs are still welcome.
6
14
7
-
#Table of Contents
15
+
Swift-Flow has adopted the name **ReSwift** and moved to it's new home as a nod to it's Redux roots that remain at it's core. Going forward, our combined efforts will be focused on ReSwift and surrounding tooling.
8
16
9
-
-[About Swift Flow](#about-reswift)
10
-
-[Why Swift Flow?](#why-reswift)
17
+
# Table of Contents
18
+
19
+
-[About ReSwift](#about-reswift)
20
+
-[Why ReSwift?](#why-reswift)
11
21
-[Getting Started Guide](#getting-started-guide)
12
22
-[Installation](#installation)
13
23
-[Testing](#testing)
@@ -17,19 +27,14 @@ If you landed here, you should also check out the great work over at [ReduxKit](
17
27
-[Credits](#credits)
18
28
-[Get in touch](#get-in-touch)
19
29
30
+
# About ReSwift
20
31
21
-
#About Swift Flow
22
-
23
-
**This library is a pre-release. Expect missing docs and breaking API changes.**
24
-
25
-
Swift Flow is a [Redux](https://github.com/rackt/redux)-like implementation of the unidirectional data flow architecture in Swift. It embraces a unidirectional data flow that only allows state mutations through declarative actions.
26
-
27
-
It relies on a few principles:
32
+
ReSwift relies on a few principles:
28
33
-**The Store** stores your entire app state in the form of a single data structure. This state can only be modified by dispatching Actions to the store. Whenever the state in the store changes, the store will notify all observers.
29
34
-**Actions** are a declarative way of describing a state change. Actions don't contain any code, they are consumed by the store and forwarded to reducers. Reducers will handle the actions by implementing a different state change for each action.
30
35
-**Reducers** provide pure functions, that based on the current action and the current app state, create a new app state
31
36
32
-

37
+

33
38
34
39
For a very simple app, that maintains a counter that can be increased and decreased, you can define the app state as following:
35
40
@@ -106,11 +111,11 @@ The `newState` method will be called by the `Store` whenever a new app state is
106
111
107
112
Button taps result in dispatched actions that will be handled by the store and its reducers, resulting in a new app state.
108
113
109
-
This is a very basic example that only shows a subset of Swift Flow's features, read the Getting Started Guide to see how you can build entire apps with this architecture.
114
+
This is a very basic example that only shows a subset of ReSwift's features, read the Getting Started Guide to see how you can build entire apps with this architecture.
110
115
111
-
[You can also watch this talk on the motivation behind Swift Flow](https://realm.io/news/benji-encz-unidirectional-data-flow-swift/).
116
+
[You can also watch this talk on the motivation behind ReSwift](https://realm.io/news/benji-encz-unidirectional-data-flow-swift/).
112
117
113
-
#Why Swift Flow?
118
+
#Why ReSwift?
114
119
115
120
Model-View-Controller (MVC) is not a holistic application architecture. Typical Cocoa apps defer a lot of complexity to controllers since MVC doesn't offer other solutions for state management, one of the most complex issues in app development.
116
121
@@ -120,25 +125,25 @@ This approach involves a lot of manual steps and is thus error prone and doesn't
120
125
121
126
It also leads to code that is difficult to understand at a glance, since dependencies can be hidden deep inside of view controllers. Lastly, you mostly end up with inconsistent code, where each developer uses the state propagation procedure they personally prefer. You can circumvent this issue by style guides and code reviews but you cannot automatically verify the adherence to these guidelines.
122
127
123
-
Swift Flow attempts to solve these problem by placing strong constraints on the way applications can be written. This reduces the room for programmer error and leads to applications that can be easily understood - by inspecting the application state data structure, the actions and the reducers.
128
+
ReSwift attempts to solve these problem by placing strong constraints on the way applications can be written. This reduces the room for programmer error and leads to applications that can be easily understood - by inspecting the application state data structure, the actions and the reducers.
124
129
125
130
This architecture provides further benefits beyond improving your code base:
126
131
127
-
- Stores, Reducers, Actions and extensions such as Swift Flow Router are entirely platform independent - you can easily use the same business logic and share it between apps for multiple platforms (iOS, tvOS, etc.)
128
-
- Want to collaborate with a co-worker on fixing an app crash? Use [Swift Flow Recorder](https://github.com/ReSwift/ReSwift-Recorder) to record the actions that lead up to the crash and send them the JSON file so that they can replay the actions and reproduce the issue right away.
132
+
- Stores, Reducers, Actions and extensions such as ReSwift Router are entirely platform independent - you can easily use the same business logic and share it between apps for multiple platforms (iOS, tvOS, etc.)
133
+
- Want to collaborate with a co-worker on fixing an app crash? Use [ReSwift Recorder](https://github.com/ReSwift/ReSwift-Recorder) to record the actions that lead up to the crash and send them the JSON file so that they can replay the actions and reproduce the issue right away.
129
134
- Maybe recorded actions can be used to build UI and integration tests?
130
135
131
-
The Swift Flow tooling is still in a very early stage, but aforementioned prospects excite me and hopefully others in the community as well!
136
+
The ReSwift tooling is still in a very early stage, but aforementioned prospects excite me and hopefully others in the community as well!
132
137
133
-
#Getting Started Guide
138
+
#Getting Started Guide
134
139
135
-
[A Getting Started Guide that describes the core components of apps built with Swift Flow lives here](Readme/GettingStarted.md). It will be expanded in the next few weeks. To get an understanding of the core principles I recommend reading the brilliant [redux documentation](http://rackt.org/redux/).
140
+
[A Getting Started Guide that describes the core components of apps built with ReSwift lives here](Readme/GettingStarted.md). It will be expanded in the next few weeks. To get an understanding of the core principles I recommend reading the brilliant [redux documentation](http://rackt.org/redux/).
136
141
137
-
#Installation
142
+
#Installation
138
143
139
-
##Cocoapods
144
+
##CocoaPods
140
145
141
-
You can install Swift Flow via CocoaPods by adding it to your `Podfile`:
146
+
You can install ReSwift via CocoaPods by adding it to your `Podfile`:
142
147
143
148
use_frameworks!
144
149
@@ -149,48 +154,48 @@ You can install Swift Flow via CocoaPods by adding it to your `Podfile`:
149
154
150
155
And run `pod install`.
151
156
152
-
##Carthage
157
+
##Carthage
153
158
154
-
You can install Swift Flow via [Carthage]() by adding the following line to your Cartfile:
159
+
You can install ReSwift via [Carthage]() by adding the following line to your Cartfile:
155
160
156
161
github "ReSwift/ReSwift"
157
162
158
-
#Checking out Source Code and Running Tests
163
+
#Checking out Source Code and Running Tests
159
164
160
165
Due to an [issue in Nimble](https://github.com/Quick/Nimble/issues/213) at the moment, tvOS tests will fail if building Nimble / Quick from source. You can however install Nimble & Quick from binaries then rebuild OSX & iOS only. After checkout, run the following from the terminal:
Using this library you can implement apps that have an explicit, reproducible state, allowing you, among many other things, to replay and rewind the app state, as shown below:
169
174
170
175

171
176
172
-
#Extensions
177
+
#Extensions
173
178
174
-
This repository contains the core component for Swift Flow, the following extensions are available:
179
+
This repository contains the core component for ReSwift, the following extensions are available:
175
180
176
181
-[ReSwift-Router](https://github.com/ReSwift/ReSwift-Router): Provides a ReSwift compatible Router that allows declarative routing in iOS applications
177
182
-[ReSwift-Recorder](https://github.com/ReSwift/ReSwift-Recorder): Provides a `Store` implementation that records all `Action`s and allows for hot-reloading and time travel
178
183
179
-
#Example Projects
184
+
#Example Projects
180
185
181
-
-[CounterExample](https://github.com/ReSwift/CounterExample): A very simple counter app implemented with Swift Flow. This app also demonstrates the basics of routing with ReSwiftRouter.
182
-
-[Meet](https://github.com/Ben-G/Meet): A real world application being built with Swift Flow - currently still very early on.
186
+
-[CounterExample](https://github.com/ReSwift/CounterExample-Navigation-TimeTravel): A very simple counter app implemented with ReSwift. This app also demonstrates the basics of routing with ReSwiftRouter.
187
+
-[Meet](https://github.com/Ben-G/Meet): A real world application being built with ReSwift - currently still very early on.
183
188
184
-
#Contributing
189
+
#Contributing
185
190
186
-
There's still a lot of work to do here! I would love to see you involved! Some design decisions for the core of Swift Flow are still up in the air (see issues), there's lots of useful documentation that can be written and a ton of extensions and tools are waiting to be built on top of Swift Flow.
191
+
There's still a lot of work to do here! I would love to see you involved! Some design decisions for the core of ReSwift are still up in the air (see issues), there's lots of useful documentation that can be written and a ton of extensions and tools are waiting to be built on top of ReSwift.
187
192
188
193
I personally think the best way to get started contributing to this library is by using it in one of your projects!
189
194
190
-
#Credits
195
+
#Credits
191
196
192
197
- Thanks a lot to [Dan Abramov](https://github.com/gaearon) for building [Redux](https://github.com/rackt/redux) - all ideas in here and many implementation details were provided by his library.
193
198
194
-
#Get in touch
199
+
#Get in touch
195
200
196
201
If you have any questions, you can find me on twitter [@benjaminencz](https://twitter.com/benjaminencz).
0 commit comments