Unidirectional Data Flow in Swift - Inspired by Redux
Other:
open func
with public func
in extensions to Store
because they cannot be overridden anyway (https://github.com/ReSwift/ReSwift/pull491) - @maksimgromovFull Changelog: https://github.com/ReSwift/ReSwift/compare/6.1.0...6.1.1
API Changes:
StateType
protocol requirement (#462) - @mjarvisOther:
S: StoreType
(#463) - @mjarvisBreaking API Changes:
API Changes:
Middleware
after store creation. (#427) - @mjarvisOther:
Breaking API Changes:
Remove StandardAction
and StandardActionConvertible
(#270) - @mjarvis
StandardAction
and StandardActionConvertible
is somewhat confusing to new users, and does not have a direct use case within the core ReSwift library. Therefore, it has been moved to ReSwift-Recorder where it belongs.StandardAction
in your project without ReSwift-Recorder
, you can copy the old implementation into your project as a middle ground while you migrate away from its usage.Make Store's state setter private (#354) - @mokagio
state
by making it private(set)
. This prevents users from bypassing reducers and middleware. All mutation of the state must occur through the normal Action
& Reducer
methods.ReSwift-Recorder
. Changes may be made to that library in the future in order to support this change.Other:
automaticallySkipsRepeats
when selecting Equatable state in Non-Equatable root state (#399) - @djtech42API Changes:
Deprecate StandardAction
and StandardActionConvertible
- @mjarvis
Deprecate ActionCreator
and AsyncActionCreator
(#391) - @mjarvis
Other
skip(when:)
and only(when:)
(#242) - @mjarvisautomaticallySkipsRepeats
configuration option to Store initializer (#262) - @DivineDominionSubscription<State>
to allow external extensions (#383) - @mjarvisOther:
Breaking API Changes:
Introduced a new Subscription API (#203) - @Ben-G, @mjarvis, @DivineDominion
The subscription API provides basic operators, such as skipRepeats
(skip calls to newState
unless state value changed) and select
(sub-select a state).
This is a breaking API change that requires migrating existing subscriptions that sub-select a portion of a store's state:
Subselecting state in 3.0.0:
store.subscribe(subscriber) { ($0.testValue, $0.otherState?.name) }
Subselecting state in 4.0.0:
store.subscribe(subscriber) {
$0.select {
($0.testValue, $0.otherState?.name)
}
}
For any store state that is Equatable
or any sub-selected state that is Equatable
, skipRepeats
will be used by default.
For states/substates that are not Equatable
, skipRepeats
can be implemented via a closure:
store.subscribe(subscriber) {
$0.select {
$0.testValue
}.skipRepeats {
return $0 == $1
}
}
Reducer type has been removed in favor of reducer function (#177) - Ben-G
Here's an example of a new app reducer, for details see the README:
func counterReducer(action: Action, state: AppState?) -> AppState {
var state = state ?? AppState()
switch action {
case _ as CounterActionIncrease:
state.counter += 1
case _ as CounterActionDecrease:
state.counter -= 1
default:
break
}
return state
}
dispatch
functions now return Void
instead of Any
(#187) - @Qata
dispatch
overload that takes a callback
argument and serves this purpose.Make dispatch
argument in middleware non-optional (#225) - @dimazen, @mjarvis, @Ben-G
Middleware
now has a generic type parameter that is used for the getState
method and matches the Store's State
type. This allows accessing the state in middleware code without type casting (#226) - @mjarvis
Other:
StoreType
with substate selector subscription (#192) - @mjarvisDispatchingStoreType
protocol for testing (#197) - @mjarvisReleased: 11/12/2016
This release supports Swift 3.0.1
Breaking API Changes:
API Changes:
Store
as open
, this reverts a previously accidental breaking API Change (#157) - @Ben-GOther:
Released: 09/15/2016
This version supports Swift 3 for Swift 2.2 support use an earlier release.
Other: