Releases: pointfreeco/swift-composable-architecture
0.53.1
What's Changed
- Fixed: A regression was introduced in 0.53.0 where
TestStore.init'sprepareDependencieswas called twice. It will not be called just a single time again (#2111). - Infrastructure: Added a "Meet the Composable Architecture" tutorial (#2107, #2109).
- Infrastructure: Docs fixes (thanks @Ryu0118, #2110)
Full Changelog: 0.53.0...0.53.1
0.53.0
What's Changed
-
Added:
Store.initandTestStore.initnow take reducer builders (#2087).// Before: Store( initialState: Feature.State(), reducer: Feature() ) // After: Store(initialState: Feature.State()) { Feature() }
-
Changed:
SwitchStorehas gotten some quality-of-life improvements (#2029).-
SwitchStore.initcan now take the initial enum state so that it can be switched over exhaustively. This initializer also relaxes certain compile-time constraints previously requiring onlyCaseLetviews and an optional, trailingDefaultview. -
CaseLetcan now omit thestateparameter label, making it more consistent with other APIs, likeReducer.ifCaseLet. -
The older
SwitchStoreandCaseLetinitializers have been soft-deprecated along with theDefaultview.// 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.debughas been renamed toWithViewStore._printChangesfor consistency withReducer._printChanges(#2101). -
Fixed:
EffectTask.publishernow 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.megaYieldtool, for more predictably testing concurrent code, is now configurable via theTASK_MEGA_YIELD_COUNTenvironment 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 theobserveparameter on view stores (#2097). -
Deprecated:
Effect.taskandEffect.fireAndForgethave 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
actionparameter inForEachStoredocumentation (thanks @m-housh, #1998).Number fact tutorial fix (thanks @siliconsorcery, #1962).
BindingActionfix (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
0.52.0
What's Changed
- Added: Support for
XCTModifyand non-exhaustive testing (#1939). - Added: Library reducer operators are now annotated with
@warn_unqualified_accessto prevent accidental bugs (#1950). - Added:
Effect.publisherfor bridging effects from Combine (#1958). - Changed:
Effect<Action>.Sendhas been renamed toSend<Action>(thanks @tgrapperon, #1930). - Changed: Dependencies have been bumped to their latest versions to encourage adoption of bug fixes (#1964).
- Fixed: Dependencies are no longer recursively propagated over effects (#1954).
- Fixed:
TestStore.initnow callsprepareDependenciesin awithDependenciesblock (#1955). - Infrastructure: Fix UI test for
ForEachbindings (#1933). - Infrastructure: Add missing documentation to
Store.init(thanks @kristofferjohansson, #1940). - Infrastructure: DocC fixes (#1942, #1956).
- Infrastructure: Update latest version documentation link in README (thanks @yimajo, #1943)
- Infrastructure: Fix
.forEach()documentation (thanks @finestructure, #1957). - Infrastructure: Documentation grammar fixes (thanks @bjford, #1963)
New Contributors
- @kristofferjohansson made their first contribution in #1940
Full Changelog: 0.51.0...0.52.0
0.51.0
What's Changed
- Added: Escaping
sendfromEffect.runand sending actions to it after the effect has completed now produces runtime warnings (thanks @kabiroberai, #1900). - Changed:
ReducerProtocol._printChanges()now logs to console for Xcode 14.3 previews (thanks @tgrapperon, #1917). - Changed: The
Sendtype has been moved to be nested in theEffecttype and should no longer take precedence over theSendableprotocol in autocomplete (thanks @tgrapperon, #1911). - Changed:
WithViewStorenow conforms toView(#1910). - Fixed: Fix some Xcode 14.3 / sendability checking warnings (#1920).
New Contributors
- @kabiroberai made their first contribution in #1900
Full Changelog: 0.50.3...0.51.0
0.50.3
What's Changed
- Changed: The
Identifiedtype has been extracted from the Composable Architecture and now comes from Identified Collections (#1907).
Full Changelog: 0.50.2...0.50.3
0.50.2
What's Changed
- Changed: Improved formatting of test store failures when expected action isn't received (#1883).
- Changed: Added unavailable overloads to
TestStore.sendandreceivewhen state/action is notEquatable(#1890). This should improve compiler error messaging when attempting to write tests against non-equatable state. - Changed:
Scope's trailing builder parameter now has an explicit name,child, andReducerProtocol.forEachhas an explicitelement(#1897). - Infrastructure: Documentation and deprecation fixes (thanks @bjford, #1893; @eimantas, #1896).
- Infrastructure: Added a workflow for Slack release announcements (#1899).
Full Changelog: 0.50.1...0.50.2
0.50.1
What's Changed
- Fixed: SwiftUI can write to bindings at inopportune times, like if a text field in a sheet is focussed, it will write to the binding after the sheet has been dismissed. When using
IfLetStore, this can lead to noisy runtime warnings emitted by TCA, where optional state driving the sheet is nownil, and thus the binding cannot write to state at this time. As a workaround,IfLetStorewill now ignore actions sent through bindings when state isnil(#1879). - Fixed: A bug in Swift 5.7 and earlier can cause the runtime metadata mechanism used by swift-case-paths to crash in release mode when an
Anyexistential exists in the type data. BecauseBindingActionholds onto anAnyunder the hood, it could be responsible for the occasional crash in release mode when present in certain type layouts. We've worked around this bug to prevent crashes in release mode (#1881). - Infrastructure: Fix docs link (thanks @Jager-yoo, #1874); add note to reducer protocol dependency docs (#1873); updated CoC to the latest Contributor Covenant.
Full Changelog: 0.50.0...0.50.1
0.50.0
What's Changed
-
Added:
@BindingState(renamed from@BindableStatein this release) now conditionally conforms toSendable(thanks @jshier, #1834). -
Added: SwiftUI Transaction helper APIs, including
Effect.transaction,ViewStore.send(_:transaction:), andEffect.run { send in send(_:transaction:) }(thanks @drucelweisse, #1824). -
Added:
Store.initnow takes aprepareDependenciesblock, for preparing the initial dependencies of a store (TestStoreintroduced a similar API earlier) (#1844). -
Added:
Effect.sendhas been introduced as a new version ofEffect.init(value:)(#1859).Effect.init(value:)has been soft-deprecated and will be hard-deprecated soon, so prefer usingEffect.sendto synchronously feed actions back into the system. -
Changed: The
@BindableStateproperty wrapper has been renamed to@BindingState(#1855). -
Changed:
TestStoreergonomics have been improved to better surface when APIs are unavailable due to lack of anEquatableconformance (#1857). -
Changed: Alert modifiers now use
@StateObjectinstead of@ObservedObjectin iOS 15 and higher (#1860). -
Changed: Reducer builders have been rewritten to be more performant and to prepare for forthcoming Swift 5.8 changes (#1863). If you notice any regressions in your app's reducer builders, please let us know.
-
Changed: The Composable Architecture has been updated to depend on SwiftUI Navigation 0.6.0 (#1865).
Warning: This upgrade contains breaking changes that mostly do not affect the Composable Architecture, with the exception of its UIKit alert helper tools, which will now require you to handle a
nilalert action for dismissal/cancel buttons with no action attached. -
Fixed: #1802 introduced a slight regression in view store binding animation behavior, so it was reverted back to the original behavior (#1845).
-
Fixed:
Effectis now hard deprecated as planned (thanks @kalupas226, #1822). -
Fixed: The Composable Architecture now explicitly depends on Ordered Collections, rather than implicitly via its transitive dependency on Identified Collections (thanks @kalupas226, #1828).
-
Fixed:
TestStore.receivemethods that take predicates and case paths no longer requireActionequatability (#1856). -
Infrastructure: Removed and updated a few deprecated, flakey tests (#1816).
-
Infrastructure: Added UI test to catch SwiftUI regressions (#1815; thanks @tgrapperon in #1819).
-
Infrastructure: Doc fixes (thanks @brennobemoura, #1843).
-
Infrastructure: Document testing gotchas (#1854).
New Contributors
- @jshier made their first contribution in #1834
- @brennobemoura made their first contribution in #1843
- @drucelweisse made their first contribution in #1824
Full Changelog: 0.49.2...0.50.0
0.49.2
What's Changed
- Fixed: A longstanding bug in SwiftUI can cause bindings to be evaluated in views that are no longer rendered. In apps built in the Composable Architecture, which provides flexible tools for deriving custom bindings, this could lead to accessing state that no longer exists, which at worst could try to evaluate an element of an array at an invalidated index, crashing the application. While this bug was fixed in 0.48.0, it introduced another regression and was reverted in 0.48.1. We have a new workaround (thanks @iampatbrown, #1802), that appears to be more reliable and work in both cases. If you encounter any regressions in
ViewStore.bindingbehavior in your applications, let us know! - Fixed:
Dependencieshas been force-bumped to 0.1.2 to work around a regression in how effects inherit dependencies (thanks @tgrapperon, #1813).
Full Changelog: 0.49.1...0.49.2
0.49.1
What's Changed
- Fixed: An internal test helper added in 0.49.0 could prevent builds from working. This has been fixed (#1809).
- Infrastructure: Fixed UIKit's "Navigate and Load" study (thanks @tgrapperon, #1807).
Full Changelog: 0.49.0...0.49.1