File tree 2 files changed +9
-6
lines changed
Sources/ComposableArchitecture
2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -6,16 +6,20 @@ extension Effect {
6
6
/// To turn an effect into a debounce-able one you must provide an identifier, which is used to
7
7
/// determine which in-flight effect should be canceled in order to start a new effect. Any
8
8
/// hashable value can be used for the identifier, such as a string, but you can add a bit of
9
- /// protection against typos by defining a new type that conforms to `Hashable`, such as an empty
10
- /// struct:
9
+ /// protection against typos by defining a new type that conforms to `Hashable`, such as an enum:
11
10
///
12
11
/// ```swift
13
12
/// case let .textChanged(text):
14
13
/// enum CancelID { case search }
15
14
///
16
- /// return self.apiClient.search(text)
17
- /// .debounce(id: CancelID.search, for: 0.5, scheduler: self.mainQueue)
18
- /// .map(Action.searchResponse)
15
+ /// return .run { send in
16
+ /// await send(
17
+ /// .searchResponse(
18
+ /// TaskResult { await self.apiClient.search(text) }
19
+ /// )
20
+ /// )
21
+ /// }
22
+ /// .debounce(id: CancelID.search, for: 0.5, scheduler: self.mainQueue)
19
23
/// ```
20
24
///
21
25
/// - Parameters:
Original file line number Diff line number Diff line change @@ -116,7 +116,6 @@ import XCTestDynamicOverlay
116
116
/// > ```
117
117
/// >
118
118
/// > (Expected: −, Actual: +)
119
- /// ```
120
119
///
121
120
/// For a more complex example, consider the following bare-bones search feature that uses a clock
122
121
/// and cancel token to debounce requests:
You can’t perform that action at this time.
0 commit comments