Skip to content

Commit 63e29b3

Browse files
authored
Deprecate Reducer.onChange(of:removeDuplicates:) (#2744)
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.
1 parent efc79f9 commit 63e29b3

File tree

3 files changed

+2
-7
lines changed

3 files changed

+2
-7
lines changed

Sources/ComposableArchitecture/Documentation.docc/Extensions/Deprecations/ReducerDeprecations.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ instead.
1818
- ``Reducer/ifCaseLet(_:action:then:fileID:line:)-36dz4``
1919
- ``Reducer/forEach(_:action:element:fileID:line:)-65nr1``
2020
- ``Reducer/forEach(_:action:destination:fileID:line:)-51zt9``
21+
- ``Reducer/onChange(of:removeDuplicates:_:)``

Sources/ComposableArchitecture/Documentation.docc/Extensions/ReducerOnChange.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

Sources/ComposableArchitecture/Reducer/Reducers/OnChange.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ extension Reducer {
5050
/// - oldValue: The old value that failed the comparison check.
5151
/// - newValue: The new value that failed the comparison check.
5252
/// - Returns: A reducer that performs the logic when the state changes.
53+
@available(*, deprecated, message: "Use 'onChange(of:)' with and equatable value, instead.")
5354
@inlinable
5455
public func onChange<V, R: Reducer>(
5556
of toValue: @escaping (State) -> V,

0 commit comments

Comments
 (0)