Releases: pointfreeco/swift-composable-architecture
0.39.0
-
Added: This release includes many new tools to better support Swift concurrency. See this discussion and this pull request for more information.
Note: Many of the old Combine-centric interfaces have been soft-deprecated. Prefer using
Effect.task
,Effect.run
, andEffect.fireAndForget
as described in the documentation. -
Infrastructure: README, documentation, and demo app fixes (thanks @filblue, @Jager-yoo, @konomae, @yimajo).
0.38.3
-
Deprecated:
Store.unchecked
has been deprecated. As the Composable Architecture migrates to modern Swift concurrency tools, its async endpoints must run on a consistent actor to ensure safety from data races. Because the primary use case of the Composable Architecture is driving UIs, we have chosen the@MainActor
for these endpoints, which makes them unsafe to call from unchecked stores. We believe the number of unchecked stores out in the wild is small, but in the meantime are soliciting feedback from the community with this deprecation warning.See #1206 for more information and migration paths.
0.38.2
- Changed: Bumped dependencies to include Combine Schedulers 0.6.0 and XCTest Dynamic Overlay 0.3.0, which includes the renamed
UnimplementedScheduler
, andXCTUnimplemented
, respectively. - Infrastructure: Cleaned up and simplified some demo apps and case studies.
0.38.1
- Fixed: 0.38.0 introduced a regression that could cause test stores that receive
BindingAction
s from effects to cause test failures. This has been fixed.
0.38.0
- Added: A new runtime warning for when a
BindingAction
is sent to the store butReducer.binding()
wasn't applied to the reducer. This should help diagnose missing integrations faster. - Fixed: A regression for
TestStore.send
andreceive
was introduced in 0.37.0 that failed to perform assertions against state when the trailing closure was omitted. This has been fixed (thanks @umbertovolta).
0.37.0
- Added:
Effect.animation()
, which adds animation to an effect without the need of a scheduler. - Changed:
TestStore
state modification failures are less noisy. - Renamed:
ViewStore.suspend(while:)
has been renamed toViewStore.yield(while:)
. - Bug fixed: A bug was introduced to the deprecated
TestStore.assert
APIs in 0.36.0, which caused test failures when a sent/received test action left state unchanged. This has been fixed. - Infrastructure: Worked around a SwiftUI bug/warning in the Case Studies demo; cleaned up some of the library's generic signatures.
0.36.0
- Added:
Effect.throttle
overloads that takeAny.Type
(thanks @elkraneo). - Added:
TestStore.state
, which reflects the state of the store between assertions. This property can be used to further probe test store state over time and make additional assertions. - Updated:
WithViewStore
can be in more places, like@CommandsBuilder
(thanks @tgrapperon). - Fixed:
Effect.task
modifiers now deliver output and completion on the main actor, avoiding potential data races. - Documentation: Added support for SPI documentation (thanks @finestructure).
- Infrastructure: typo fixes (thanks @konomae) and demo app cleanup.
0.35.0
-
Breaking change: test stores will now catch assertions that do not change state (thanks @rcarver).
// Before: store.send(.actionThatDoesntChangeState) { $0.state = .sameStateAsBefore } // ✅ // After: store.send(.actionThatDoesntChangeState) { $0.state = .sameStateAsBefore } // ❌ Expected to modify the expected state, but no change occurred.
To fix, remove the trailing closure assertion to let the test store know you don't expect its state to change:
store.send(.actionThatDoesntChangeState) // ✅
-
Added: Effect cancellation endpoints can now take types as identifiers, a slightly simpler alternative to safely defining and instantiating a hashable type:
// Before: struct CancelId: Hashable {} return .cancel(id: CancelId()) // After: enum CancelId {} return .cancel(id: CancelId.self)
-
Added: A new overload of
eraseToEffect
that takes a transform function. This provides symmetry tocatchToEffect
and can help streamline effect work in the reducer (thanks @klundberg).// Before: return environment.doSomething() .map(Action.case) .eraseToEffect() // After: return environment.doSomething() .eraseToEffect(Action.case)
-
Added: A new overload of
Effect.fireAndForget
that takes an async, throwing function.return .fireAndForget { try await environment.analytics(event: .tappedProfile) }
-
Changed: The synchronous version of
Effect.fireAndForget
can nowthrow
, which will simply terminate the effect's execution early if an error is thrown. -
Changed: Runtime warnings should now show up closer to the source of the warning (thanks @iampatbrown).
-
Changed: When multiple
TestStore
failure messages stack, they should print in a better, more readable order. -
Changed: Case Paths has been pinned to a newer version (thanks @nsillik).
-
Fixed: A bug in which the array-based overload of
Effect.cancel(ids:)
was not being favored over the variadic overload would treat the entire array as the cancel token and not each individual item has been fixed (thanks @iampatbrown). -
Fixed: A few small warnings that show up in Swift 5.7 have been fixed.
-
Performance: Effect cancellation lookup has been improved for type-safe identifiers.
-
Infrastructure: Fixed SPI's config file (thanks @finestructure).
-
Infrastructure: The long-living effect SwiftUI case study has been modernized and simplified.
0.34.0
- Changed: An effect is now not considered "in-flight" till it is kicked off. This fixes a potential behavior where marking a timer effect cancellable (which is already cancellable by default) could prevent the effect from running.
- Changed: Runtime warnings now emit XCTest failures, as well, making it easier to catch common issues in your tests.
- Optimized: In-flight effects are now cancelled inline (thanks @iampatbrown).
- Fixed:
Effect.cancel(ids:)
now properly routes to the sequence overload (thanks @iampatbrown). - Fixed:
WithViewStore
no longer breaks in certain contexts, e.g. when placed inside aGeometryReader
(thanks @tgrapperon). - Infrastructure: Added Arabic translation to README (thanks @NorhanBoghdadi).
- Infrastructure: Added Simplified Chinese translation to README (thanks @sh3l6orrr).
- Infrastructure: Cleaned up case studies (thanks @rono23).
- Infrastructure: Fixed and added unit tests to UIKit list case study (thanks @bjford).
- Infrastructure: Fixed a few missing asset warnings in demo applications (thanks @tgrapperon).