0.35.0
版本发布时间: 2022-05-17 00:41:17
pointfreeco/swift-composable-architecture最新发布版本:1.15.2(2024-10-23 00:57:58)
-
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.