Skip to content

Commit a66ba01

Browse files
authored
Trait-deprecate store.send(_:animation:) (#3903)
We'll favor wrapping with `withAnimation` in TCA2.
1 parent ac32f69 commit a66ba01

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

Sources/ComposableArchitecture/Store.swift

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,30 @@ public final class Store<State, Action>: _Store {
177177
/// - Parameters:
178178
/// - action: An action.
179179
/// - animation: An animation.
180+
#if ComposableArchitecture2Deprecations
181+
@available(*, deprecated, message: "Use 'withAnimation { _ = store.send(action) }' instead")
182+
#else
183+
@available(
184+
iOS,
185+
deprecated: 9999,
186+
message: "Use 'withAnimation { _ = store.send(action) }' instead"
187+
)
188+
@available(
189+
macOS,
190+
deprecated: 9999,
191+
message: "Use 'withAnimation { _ = store.send(action) }' instead"
192+
)
193+
@available(
194+
tvOS,
195+
deprecated: 9999,
196+
message: "Use 'withAnimation { _ = store.send(action) }' instead"
197+
)
198+
@available(
199+
watchOS,
200+
deprecated: 9999,
201+
message: "Use 'withAnimation { _ = store.send(action) }' instead"
202+
)
203+
#endif
180204
@discardableResult
181205
public func send(_ action: Action, animation: Animation?) -> StoreTask {
182206
send(action, transaction: Transaction(animation: animation))
@@ -189,6 +213,36 @@ public final class Store<State, Action>: _Store {
189213
/// - Parameters:
190214
/// - action: An action.
191215
/// - transaction: A transaction.
216+
#if ComposableArchitecture2Deprecations
217+
@available(
218+
*,
219+
deprecated,
220+
message: """
221+
Use 'withTransaction(transaction) { _ = store.send(action) }' instead
222+
"""
223+
)
224+
#else
225+
@available(
226+
iOS,
227+
deprecated: 9999,
228+
message: "Use 'withTransaction(transaction) { _ = store.send(action) }' instead"
229+
)
230+
@available(
231+
macOS,
232+
deprecated: 9999,
233+
message: "Use 'withTransaction(transaction) { _ = store.send(action) }' instead"
234+
)
235+
@available(
236+
tvOS,
237+
deprecated: 9999,
238+
message: "Use 'withTransaction(transaction) { _ = store.send(action) }' instead"
239+
)
240+
@available(
241+
watchOS,
242+
deprecated: 9999,
243+
message: "Use 'withTransaction(transaction) { _ = store.send(action) }' instead"
244+
)
245+
#endif
192246
@discardableResult
193247
public func send(_ action: Action, transaction: Transaction) -> StoreTask {
194248
withTransaction(transaction) {

0 commit comments

Comments
 (0)