Skip to content

Commit ae5a593

Browse files
committed
Move send(_:animation:) to ViewStore.swift. (#1075)
1 parent b283e2d commit ae5a593

File tree

3 files changed

+14
-17
lines changed

3 files changed

+14
-17
lines changed

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.3
1+
// swift-tools-version:5.5
22

33
import PackageDescription
44

Sources/ComposableArchitecture/SwiftUI/Animation.swift

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

Sources/ComposableArchitecture/ViewStore.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,19 @@ public final class ViewStore<State, Action> {
156156
}
157157

158158
#if canImport(SwiftUI)
159+
/// Sends an action to the store with a given animation.
160+
///
161+
/// See ``ViewStore/send(_:)`` for more info.
162+
///
163+
/// - Parameters:
164+
/// - action: An action.
165+
/// - animation: An animation.
166+
public func send(_ action: Action, animation: Animation?) {
167+
withAnimation(animation) {
168+
self.send(action)
169+
}
170+
}
171+
159172
/// Derives a binding from the store that prevents direct writes to state and instead sends
160173
/// actions to the store.
161174
///

0 commit comments

Comments
 (0)