What's Changed
-
Added:
Store.init
andTestStore.init
now take reducer builders (#2087).// Before: Store( initialState: Feature.State(), reducer: Feature() ) // After: Store(initialState: Feature.State()) { Feature() }
-
Changed:
SwitchStore
has gotten some quality-of-life improvements (#2029).-
SwitchStore.init
can now take the initial enum state so that it can be switched over exhaustively. This initializer also relaxes certain compile-time constraints previously requiring onlyCaseLet
views and an optional, trailingDefault
view. -
CaseLet
can now omit thestate
parameter label, making it more consistent with other APIs, likeReducer.ifCaseLet
. -
The older
SwitchStore
andCaseLet
initializers have been soft-deprecated along with theDefault
view.// Before: SwitchStore(self.store) { CaseLet(state: /App.State.loggedIn, action: App.Action.loggedIn) { loggedInStore in LoggedInView(store: loggedInStore) } CaseLet(state: /App.State.loggedOut, action: App.Action.loggedOut) { loggedOutStore in LoggedOutView(store: loggedOutStore) } } // After: SwitchStore(self.store) { switch $0 { // Can now switch over initial state for exhaustivity at compile time case .loggedIn: CaseLet(/App.State.loggedIn, action: App.Action.loggedIn) { loggedInStore in LoggedInView(store: loggedInStore) } .buttonStyle(.plain) // Can now render arbitrary views/modifiers in the view builder case .loggedOut: CaseLet(/App.State.loggedOut, action: App.Action.loggedOut) { loggedOutStore in LoggedOutView(store: loggedOutStore) } } }
-
-
Changed:
WithViewStore.debug
has been renamed toWithViewStore._printChanges
for consistency withReducer._printChanges
(#2101). -
Fixed:
EffectTask.publisher
now properly escapes dependencies accessed within it (#1988). -
Fixed:
Reducer._printChanges()
is no longer disabled in tests (#1995). This allows it to be used for debugging purposes during test runs. -
Changed: The internal
Task.megaYield
tool, for more predictably testing concurrent code, is now configurable via theTASK_MEGA_YIELD_COUNT
environment variable (#2064). -
Improved: The output format of
WithViewStore._printChanges()
has been improved (#1973). -
Improved: Runtime warnings will now emit XCTest failures in test code rather than in app code (#2059).
-
Deprecated: Type-based cancel IDs have been deprecated (#2091). Use hashable values, instead.
-
Deprecated: The actionless overload of
Store.scope(state:)
has been deprecated in favor of theobserve
parameter on view stores (#2097). -
Deprecated:
Effect.task
andEffect.fireAndForget
have been soft-deprecated in favor ofEffect.run
(#2099). -
Infrastructure: Added test coverage for child/parent effect cancellation behavior (#1970).
-
Infrastructure: Clean up effect cancellation logic (#1977).
-
Infrastructure: Miscellaneous documentation/formatting fixes:
Fixed missing
action
parameter inForEachStore
documentation (thanks @m-housh, #1998).Number fact tutorial fix (thanks @siliconsorcery, #1962).
BindingAction
fix (thanks @Ryu0118, #2019).withTaskCancellation(id:)
fix (thanks @bjford, #2049).Formatting fix (thanks @mooyoung2309, #2056).
Update 'bindable state' to 'binding state' (thanks @Jager-yoo, #2054).
-
Infrastructure: Added Russian README translation (thanks @artyom-ivanov, #2014).
-
Infrastructure: Added Polish README translation (thanks @MarcelStarczyk, #2040).
-
Infrastructure: Bump dependencies.
-
Infrastructure: Bump Xcode demo project settings (#2042).
-
Infrastructure: Clean up and test
TestStore.skipInFlightEffects
(#2057). -
Infrastructure: CI updates (#2060).
-
Infrastructure: Document how exhaustive vs. non-exhaustive test stores work (#2096).
New Contributors
- @m-housh made their first contribution in #1998
- @siliconsorcery made their first contribution in #1962
- @artyom-ivanov made their first contribution in #2014
- @Ryu0118 made their first contribution in #2019
- @MarcelStarczyk made their first contribution in #2040
- @mooyoung2309 made their first contribution in #2056
Full Changelog: 0.52.0...0.53.0