Skip to content

Commit

Permalink
Deprecate Reducer.onChange(of:removeDuplicates:) (#2744)
Browse files Browse the repository at this point in the history
The `removeDuplicates` overload is just too tough on the compiler to
resolve, so we don't think it's worth shipping in the library in the
long run. SwiftUI's `View.onChange` doesn't have such an option, and
adding such a signature results in the same compiler issues. Let's stick
with the interface that most closely matches SwiftUI's and avoid
interfaces that are problematic for the compiler.
  • Loading branch information
stephencelis authored Jan 30, 2024
1 parent efc79f9 commit 63e29b3
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ instead.
- ``Reducer/ifCaseLet(_:action:then:fileID:line:)-36dz4``
- ``Reducer/forEach(_:action:element:fileID:line:)-65nr1``
- ``Reducer/forEach(_:action:destination:fileID:line:)-51zt9``
- ``Reducer/onChange(of:removeDuplicates:_:)``

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ extension Reducer {
/// - oldValue: The old value that failed the comparison check.
/// - newValue: The new value that failed the comparison check.
/// - Returns: A reducer that performs the logic when the state changes.
@available(*, deprecated, message: "Use 'onChange(of:)' with and equatable value, instead.")
@inlinable
public func onChange<V, R: Reducer>(
of toValue: @escaping (State) -> V,
Expand Down

0 comments on commit 63e29b3

Please sign in to comment.