Skip to content

Commit 933e5bf

Browse files
mluisbrownmbrandonw
andcommitted
Support DocC Xcode 13 (#591)
* wip * finish * revert back code snippet identation to 5 * Update Sources/ComposableArchitecture/Effect.swift Co-authored-by: Brandon Williams <[email protected]> Co-authored-by: Brandon Williams <[email protected]>
1 parent cc3d551 commit 933e5bf

19 files changed

+1414
-1266
lines changed

Sources/ComposableArchitecture/Debugging/ReducerDebugging.swift

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
import CasePaths
22
import Dispatch
33

4-
/// Determines how the string description of an action should be printed when using the `.debug()`
4+
/// Determines how the string description of an action should be printed when using the ``Reducer/debug(prefix:state:action:environment:)``
55
/// higher-order reducer.
66
public enum ActionFormat {
77
/// Prints the action in a single line by only specifying the labels of the associated values:
88
///
9+
/// ```swift
910
/// Action.screenA(.row(index:, action: .textChanged(query:)))
11+
/// ```
12+
///
1013
case labelsOnly
1114
/// Prints the action in a multiline, pretty-printed format, including all the labels of
1215
/// any associated values, as well as the data held in the associated values:
1316
///
17+
/// ```swift
1418
/// Action.screenA(
1519
/// ScreenA.row(
1620
/// index: 1,
@@ -19,6 +23,8 @@ public enum ActionFormat {
1923
/// )
2024
/// )
2125
/// )
26+
/// ```
27+
///
2228
case prettyPrint
2329
}
2430

@@ -31,7 +37,7 @@ extension Reducer {
3137
/// - prefix: A string with which to prefix all debug messages.
3238
/// - toDebugEnvironment: A function that transforms an environment into a debug environment by
3339
/// describing a print function and a queue to print from. Defaults to a function that ignores
34-
/// the environment and returns a default `DebugEnvironment` that uses Swift's `print`
40+
/// the environment and returns a default ``DebugEnvironment`` that uses Swift's `print`
3541
/// function and a background queue.
3642
/// - Returns: A reducer that prints debug messages for all received actions.
3743
public func debug(
@@ -58,7 +64,7 @@ extension Reducer {
5864
/// - prefix: A string with which to prefix all debug messages.
5965
/// - toDebugEnvironment: A function that transforms an environment into a debug environment by
6066
/// describing a print function and a queue to print from. Defaults to a function that ignores
61-
/// the environment and returns a default `DebugEnvironment` that uses Swift's `print`
67+
/// the environment and returns a default ``DebugEnvironment`` that uses Swift's `print`
6268
/// function and a background queue.
6369
/// - Returns: A reducer that prints debug messages for all received actions.
6470
public func debugActions(
@@ -87,7 +93,7 @@ extension Reducer {
8793
/// - toLocalAction: A case path that filters actions that are printed.
8894
/// - toDebugEnvironment: A function that transforms an environment into a debug environment by
8995
/// describing a print function and a queue to print from. Defaults to a function that ignores
90-
/// the environment and returns a default `DebugEnvironment` that uses Swift's `print`
96+
/// the environment and returns a default ``DebugEnvironment`` that uses Swift's `print`
9197
/// function and a background queue.
9298
/// - Returns: A reducer that prints debug messages for all received actions.
9399
public func debug<LocalState, LocalAction>(

Sources/ComposableArchitecture/Effects/Cancellation.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@ extension Effect {
1515
/// Turns an effect into one that is capable of being canceled.
1616
///
1717
/// To turn an effect into a cancellable one you must provide an identifier, which is used in
18-
/// `Effect.cancel(id:)` to identify which in-flight effect should be canceled. Any hashable
18+
/// ``Effect/cancel(id:)`` to identify which in-flight effect should be canceled. Any hashable
1919
/// value can be used for the identifier, such as a string, but you can add a bit of protection
2020
/// against typos by defining a new type that conforms to `Hashable`, such as an empty struct:
2121
///
22+
/// ```swift
2223
/// struct LoadUserId: Hashable {}
2324
///
2425
/// case .reloadButtonTapped:
@@ -30,6 +31,7 @@ extension Effect {
3031
/// case .cancelButtonTapped:
3132
/// // Cancel any in-flight requests to load the user
3233
/// return .cancel(id: LoadUserId())
34+
/// ```
3335
///
3436
/// - Parameters:
3537
/// - id: The effect's identifier.

Sources/ComposableArchitecture/Effects/Debouncing.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@ extension Effect {
1010
/// protection against typos by defining a new type that conforms to `Hashable`, such as an empty
1111
/// struct:
1212
///
13+
/// ```swift
1314
/// case let .textChanged(text):
1415
/// struct SearchId: Hashable {}
1516
///
1617
/// return environment.search(text)
1718
/// .map(Action.searchResponse)
1819
/// .debounce(id: SearchId(), for: 0.5, scheduler: environment.mainQueue)
19-
///
20+
/// ```
21+
///
2022
/// - Parameters:
2123
/// - id: The effect's identifier.
2224
/// - dueTime: The duration you want to debounce for.

Sources/ComposableArchitecture/Effects/Timer.swift

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ extension Effect where Value == Date, Error == Never {
99
/// and which adds the the ability to be cancelled via the `id`.
1010
///
1111
/// To start and stop a timer in your feature you can create the timer effect from an action
12-
/// and then use the `.cancel(id:)` effect to stop the timer:
12+
/// and then use the ``Effect/cancel(id:)`` effect to stop the timer:
1313
///
14+
/// ```swift
1415
/// struct AppState {
1516
/// var count = 0
1617
/// }
@@ -38,34 +39,37 @@ extension Effect where Value == Date, Error == Never {
3839
/// state.count += 1
3940
/// return .none
4041
/// }
42+
/// ```
4143
///
4244
/// Then to test the timer in this feature you can use a test scheduler to advance time:
4345
///
44-
/// func testTimer() {
45-
/// let scheduler = TestScheduler()
46+
/// ```swift
47+
/// func testTimer() {
48+
/// let scheduler = TestScheduler()
4649
///
47-
/// let store = TestStore(
48-
/// initialState: .init(),
49-
/// reducer: appReducer,
50-
/// envirnoment: .init(
51-
/// mainQueue: scheduler
50+
/// let store = TestStore(
51+
/// initialState: .init(),
52+
/// reducer: appReducer,
53+
/// envirnoment: .init(
54+
/// mainQueue: scheduler
55+
/// )
5256
/// )
53-
/// )
5457
///
55-
/// store.send(.startButtonTapped)
58+
/// store.send(.startButtonTapped)
5659
///
57-
/// scheduler.advance(by: .seconds(1))
58-
/// store.receive(.timerTicked) { $0.count = 1 }
60+
/// scheduler.advance(by: .seconds(1))
61+
/// store.receive(.timerTicked) { $0.count = 1 }
5962
///
60-
/// scheduler.advance(by: .seconds(5))
61-
/// store.receive(.timerTicked) { $0.count = 2 }
62-
/// store.receive(.timerTicked) { $0.count = 3 }
63-
/// store.receive(.timerTicked) { $0.count = 4 }
64-
/// store.receive(.timerTicked) { $0.count = 5 }
65-
/// store.receive(.timerTicked) { $0.count = 6 }
63+
/// scheduler.advance(by: .seconds(5))
64+
/// store.receive(.timerTicked) { $0.count = 2 }
65+
/// store.receive(.timerTicked) { $0.count = 3 }
66+
/// store.receive(.timerTicked) { $0.count = 4 }
67+
/// store.receive(.timerTicked) { $0.count = 5 }
68+
/// store.receive(.timerTicked) { $0.count = 6 }
6669
///
67-
/// store.send(.stopButtonTapped)
68-
/// }
70+
/// store.send(.stopButtonTapped)
71+
/// }
72+
/// ```
6973
///
7074
/// - Parameters:
7175
/// - interval: The time interval on which to publish events. For example, a value of `0.5`

0 commit comments

Comments
 (0)