Skip to content

Commit 9f4202a

Browse files
pyrtsastephencelis
andauthored
Undeprecate debounce and throttle overloads restored in 1.1.0 (#2392)
* Undeprecate debounce and throttle overloads restored in 1.1.0 * Apply suggestions from code review --------- Co-authored-by: Stephen Celis <[email protected]>
1 parent 974fb9f commit 9f4202a

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

Sources/ComposableArchitecture/Effects/Publisher/Debouncing.swift

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
import Combine
22

3-
@available(
4-
*,
5-
deprecated,
6-
message: "Use 'withTaskCancellation(id: _, cancelInFlight: true)' in 'Effect.run', instead."
7-
)
83
extension EffectPublisher {
94
/// Turns an effect into one that can be debounced.
105
///
@@ -63,6 +58,14 @@ extension EffectPublisher {
6358
/// - scheduler: The scheduler you want to deliver the debounced output to.
6459
/// - options: Scheduler options that customize the effect's delivery of elements.
6560
/// - Returns: An effect that publishes events only after a specified time elapses.
61+
@available(
62+
*,
63+
deprecated,
64+
message:
65+
"""
66+
Types defined for cancellation may be compiled out of release builds in Swift and are unsafe to use. Use a hashable value, instead, e.g. define a timer cancel identifier as 'enum CancelID { case debounce }' and call 'effect.debounce(id: CancelID.debounce, …)'.
67+
"""
68+
)
6669
public func debounce<S: Scheduler>(
6770
id: Any.Type,
6871
for dueTime: S.SchedulerTimeType.Stride,

Sources/ComposableArchitecture/Effects/Publisher/Throttling.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import Combine
22
import Dispatch
33
import Foundation
44

5-
@available(*, deprecated)
65
extension EffectPublisher {
76
/// Throttles an effect so that it only publishes one output per given interval.
87
///
@@ -80,6 +79,14 @@ extension EffectPublisher {
8079
/// `false`, the publisher emits the first element received during the interval.
8180
/// - Returns: An effect that emits either the most-recent or first element received during the
8281
/// specified interval.
82+
@available(
83+
*,
84+
deprecated,
85+
message:
86+
"""
87+
Types defined for cancellation may be compiled out of release builds in Swift and are unsafe to use. Use a hashable value, instead, e.g. define a timer cancel identifier as 'enum CancelID { case throttle }' and call 'effect.throttle(id: CancelID.throttle, …)'.
88+
"""
89+
)
8390
public func throttle<S: Scheduler>(
8491
id: Any.Type,
8592
for interval: S.SchedulerTimeType.Stride,

0 commit comments

Comments
 (0)