We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 681ab42 commit 81baef3Copy full SHA for 81baef3
Sources/Intramodular/Animation/PredicatedAnimation.swift
@@ -11,15 +11,19 @@ private struct PredicatedAnimateOnChange<Value: Equatable>: ViewModifier {
11
let predicate: ((oldValue: Value, newValue: Value)) -> Bool
12
13
@ViewStorage private var lastValue: Value?
14
-
+
15
func body(content: Content) -> some View {
16
- content.transaction { view in
17
- if let oldValue = lastValue {
18
- if predicate((oldValue, value)) {
19
- view.animation = animation
+ content
+ .transaction { view in
+ if let oldValue = lastValue {
+ if predicate((oldValue, value)) {
20
+ view.animation = animation
21
+ }
22
}
23
- }
24
+ .onChange(of: value) { value in
25
+ self.lastValue = value
26
27
28
29
0 commit comments