SwiftDux is a Swift implementation of Redux. It closely adheres to the original Redux structure defined by Dan Abramov. SwiftDux originally began as a fork of ReSwift, but eventually diverged into its own project due substantial interface and implementation differences. Key features of SwiftDux include:
- Thread safety: in Redux, all state modifications must be performed one-by-one. SwiftDux guarantees this by performing all state modifications, as well as adding and removing subscribers, on a serial
OperationQueue. State reads in asynchronous actions are also dispatched on the same queue, ensuring data integrity. - Easy-to-use subscriptions: SwiftDux includes two simple classes for handling subscriptions-
StoreStateSubscription, for subscribers who want to be notified about any change at all to the global state; andSubstatesSubscription, for subscribers who only want to be notified of changes to one or more specific keypaths of the global state. While these two classes cover the vast majority of use-cases, callers can create a custom implementation ofStoreSubscriptionProtocolif they wish. - Type safety: SwiftDux does not use force-casts or implicit-unwraps anywhere in its source code. Subscriptions also capture your app's specific state type as an
associatedtype, rather than asAny; this eliminates the possibility of subscribers not being updated because of a downcast failure.
Add pod 'SwiftDux', :git => 'https://github.com/jpeckner/SwiftDux.git', :branch => 'master' to your Podfile, then run pod install.
Add github "jpeckner/SwiftDux" to your Cartfile, then run carthage update SwiftDux --platform iOS.
Simply add SwiftDux.xcodeproj to your workspace.
This project is licensed under the MIT License - see the LICENSE file for details.