Skip to content

Commit 5b4f002

Browse files
authored
Fix some docs (pointfreeco#2498)
* Delete unnecessary block * Fix debounce document
1 parent 2e0f514 commit 5b4f002

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

Sources/ComposableArchitecture/Effects/Debounce.swift

+9-5
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,20 @@ extension Effect {
66
/// To turn an effect into a debounce-able one you must provide an identifier, which is used to
77
/// determine which in-flight effect should be canceled in order to start a new effect. Any
88
/// 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:
1110
///
1211
/// ```swift
1312
/// case let .textChanged(text):
1413
/// enum CancelID { case search }
1514
///
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)
1923
/// ```
2024
///
2125
/// - Parameters:

Sources/ComposableArchitecture/TestStore.swift

-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ import XCTestDynamicOverlay
116116
/// > ```
117117
/// >
118118
/// > (Expected: −, Actual: +)
119-
/// ```
120119
///
121120
/// For a more complex example, consider the following bare-bones search feature that uses a clock
122121
/// and cancel token to debounce requests:

0 commit comments

Comments
 (0)