Move send(_:animation:) to ViewStore.swift. (#1075)

This commit is contained in:
Brandon Williams
2022-05-02 17:44:45 -07:00
committed by GitHub
parent 007c857bde
commit af3eed801a
2 changed files with 13 additions and 14 deletions

View File

@@ -142,6 +142,19 @@ public final class ViewStore<State, Action>: ObservableObject {
self._send(action)
}
/// Sends an action to the store with a given animation.
///
/// See ``ViewStore/send(_:)`` for more info.
///
/// - Parameters:
/// - action: An action.
/// - animation: An animation.
public func send(_ action: Action, animation: Animation?) {
withAnimation(animation) {
self.send(action)
}
}
/// Derives a binding from the store that prevents direct writes to state and instead sends
/// actions to the store.
///