Skip to content

Commit 685e8fc

Browse files
authored
DocC fixes (#1942)
We have a number of outdated DocC references. This PR should hopefully take care of them!
1 parent 58d0063 commit 685e8fc

File tree

20 files changed

+101
-62
lines changed

20 files changed

+101
-62
lines changed

ComposableArchitecture.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Sources/ComposableArchitecture/Documentation.docc/Articles/MigratingToTheReducerProtocol.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ Similar to `optional` reducers, another common pattern in applications is the us
417417
``AnyReducer/forEach(state:action:environment:file:fileID:line:)-2ypoa`` to allow running a reducer
418418
on each element of a collection. Converting such child and parent reducers will look nearly
419419
identical to what we did above for optional reducers, but it will make use of the new
420-
``ReducerProtocol/forEach(_:action:_:file:fileID:line:)`` operator instead.
420+
``ReducerProtocol/forEach(_:action:element:file:fileID:line:)`` operator instead.
421421

422422
In particular, the new `forEach` method operates on the parent reducer by specifying the collection
423423
sub-state you want to work on, and providing the element reducer you want to be able to run on
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Deprecations
2+
3+
Review unsupported `Reduce` APIs.
4+
5+
## Topics
6+
7+
### Reducer structure
8+
9+
- ``Reduce/init(_:environment:)``

Sources/ComposableArchitecture/Documentation.docc/Extensions/Deprecations/ReducerDeprecations.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,3 @@ instead.
1414
- ``AnyReducer``
1515
- ``Reducer``
1616
- ``DebugEnvironment``
17-
- ``Identified``

Sources/ComposableArchitecture/Documentation.docc/Extensions/Deprecations/SwiftUIDeprecations.md

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,5 @@ Avoid using deprecated APIs in your app. Select a method to see the replacement
1515

1616
### WithViewStore
1717

18-
- ``WithViewStore/init(_:content:file:line:)-1gjbi``
19-
- ``WithViewStore/init(_:content:file:line:)-2uj44``
20-
- ``WithViewStore/init(_:content:file:line:)-5vj3w``
21-
- ``WithViewStore/init(_:content:file:line:)-5zsmz``
22-
- ``WithViewStore/init(_:content:file:line:)-7kai``
23-
- ``WithViewStore/init(_:file:line:content:)-4xog0``
24-
- ``WithViewStore/init(_:file:line:content:)-55smh``
25-
- ``WithViewStore/init(_:file:line:content:)-7qkc1``
26-
- ``WithViewStore/init(_:file:line:content:)-8b21b``
27-
- ``WithViewStore/init(_:file:line:content:)-9b6e2``
28-
- ``WithViewStore/init(_:removeDuplicates:content:file:line:)-1lyhl``
29-
- ``WithViewStore/init(_:removeDuplicates:content:file:line:)-35xje``
30-
- ``WithViewStore/init(_:removeDuplicates:content:file:line:)-8zzun``
31-
- ``WithViewStore/init(_:removeDuplicates:content:file:line:)-9atby``
32-
- ``WithViewStore/init(_:removeDuplicates:file:line:content:)``
3318
- ``WithViewStore/Action``
3419
- ``WithViewStore/State``
35-
36-
<!--DocC: Can't currently document `View` extensions-->
37-
<!--### View Modifiers-->

Sources/ComposableArchitecture/Documentation.docc/Extensions/Deprecations/TestStoreDeprecations.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Avoid using deprecated APIs in your app. Select a method to see the replacement
1111
### Creating a test store
1212

1313
- ``TestStore/init(initialState:reducer:environment:file:line:)``
14+
- ``TestStore/init(initialState:reducer:prepareDependencies:file:line:)-72tkt``
1415

1516
### Configuring a test store
1617

@@ -20,8 +21,8 @@ Avoid using deprecated APIs in your app. Select a method to see the replacement
2021

2122
- ``TestStore/send(_:assert:file:line:)-30pjj``
2223
- ``TestStore/receive(_:assert:file:line:)-2nhm0``
23-
- ``TestStore/receive(_:assert:file:line:)-6fuav``
24-
- ``TestStore/receive(_:assert:file:line:)-u5tf``
24+
- ``TestStore/receive(_:assert:file:line:)-1bfw4``
25+
- ``TestStore/receive(_:assert:file:line:)-5o4u3``
2526
- ``TestStore/assert(_:file:line:)-707lb``
2627
- ``TestStore/assert(_:file:line:)-4gff7``
2728
- ``TestStore/LocalState``
@@ -32,3 +33,8 @@ Avoid using deprecated APIs in your app. Select a method to see the replacement
3233

3334
- ``TestStore/skipReceivedActions(strict:file:line:)-3nldt``
3435
- ``TestStore/skipInFlightEffects(strict:file:line:)-95n5f``
36+
37+
### Scoping test stores
38+
39+
- ``TestStore/scope(state:action:)``
40+
- ``TestStore/scope(state:)``

Sources/ComposableArchitecture/Documentation.docc/Extensions/Deprecations/ViewStoreDeprecations.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ Avoid using deprecated APIs in your app. Select a method to see the replacement
1919

2020
### SwiftUI integration
2121

22-
- ``ViewStore/subscript(dynamicMember:)-7xjrv``
22+
- ``ViewStore/subscript(dynamicMember:)-3q4xh``
2323
- ``ViewStore/binding(keyPath:send:)``

Sources/ComposableArchitecture/Documentation.docc/Extensions/Effect.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@
2424
- ``EffectPublisher/merge(_:)-45guh``
2525
- ``EffectPublisher/merge(_:)-3d54p``
2626

27-
### Concurrency
28-
29-
- ``UncheckedSendable``
30-
3127
### Testing
3228

3329
- ``EffectPublisher/unimplemented(_:)``
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# ``ComposableArchitecture/Reduce``
2+
3+
## Topics
4+
5+
### Creating a reducer
6+
7+
- ``init(_:)-17fld``
8+
9+
### Type erased reducers
10+
11+
- ``init(_:)-3rph8``
12+
13+
### Deprecations
14+
15+
- <doc:ReduceDeprecations>

Sources/ComposableArchitecture/Documentation.docc/Extensions/ReducerProtocol.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
- ``reduce(into:action:)-8yinq``
88
- ``State``
99
- ``Action``
10-
- ``EffectPublisher``
10+
- ``EffectTask``
1111

1212
### Reducer composition
1313

@@ -17,21 +17,21 @@
1717
- ``Scope``
1818
- ``ifLet(_:action:then:file:fileID:line:)``
1919
- ``ifCaseLet(_:action:then:file:fileID:line:)``
20-
- ``forEach(_:action:_:file:fileID:line:)``
20+
- ``forEach(_:action:element:file:fileID:line:)``
2121

2222
### Supporting reducers
2323

24-
- ``BindingReducer``
24+
- ``Reduce``
2525
- ``CombineReducers``
2626
- ``EmptyReducer``
27-
- ``Reduce``
27+
- ``BindingReducer``
2828

2929
### Reducer modifiers
3030

3131
- ``dependency(_:_:)``
3232
- ``transformDependency(_:transform:)``
33+
- ``_printChanges(_:)``
3334
- ``signpost(_:log:)``
34-
- ``debug()``
3535

3636
### Deprecations
3737

Sources/ComposableArchitecture/Documentation.docc/Extensions/Store.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
### Creating a store
66

7-
- ``init(initialState:reducer:)``
7+
- ``init(initialState:reducer:prepareDependencies:)``
88
- ``StoreOf``
99

1010
### Scoping stores
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# ``ComposableArchitecture/TaskResult``
2+
3+
## Topics
4+
5+
### Representing a task result
6+
7+
- ``success(_:)``
8+
- ``failure(_:)``
9+
10+
### Converting a throwing expression
11+
12+
- ``init(catching:)``
13+
14+
### Accessing a result's value
15+
16+
- ``value``
17+
18+
### Transforming results
19+
20+
- ``map(_:)``
21+
- ``flatMap(_:)``
22+
- ``init(_:)``

Sources/ComposableArchitecture/Documentation.docc/Extensions/TestStore.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44

55
### Creating a test store
66

7-
- ``init(initialState:reducer:prepareDependencies:file:line:)``
7+
- ``init(initialState:reducer:prepareDependencies:file:line:)-55zkv``
8+
- ``init(initialState:reducer:observe:prepareDependencies:file:line:)``
9+
- ``init(initialState:reducer:observe:send:prepareDependencies:file:line:)``
810

911
### Configuring a test store
1012

@@ -16,8 +18,8 @@
1618

1719
- ``send(_:assert:file:line:)-1ax61``
1820
- ``receive(_:timeout:assert:file:line:)-1rwdd``
19-
- ``receive(_:timeout:assert:file:line:)-4e4m0``
20-
- ``receive(_:timeout:assert:file:line:)-3myco``
21+
- ``receive(_:timeout:assert:file:line:)-8xkqt``
22+
- ``receive(_:timeout:assert:file:line:)-2ju31``
2123
- ``finish(timeout:file:line:)``
2224
- ``TestStoreTask``
2325

@@ -32,11 +34,6 @@ While the most common way of interacting with a test store's state is via its ``
3234

3335
- ``state``
3436

35-
### Scoping test stores
36-
37-
- ``scope(state:action:)``
38-
- ``scope(state:)``
39-
4037
### Deprecations
4138

4239
- <doc:TestStoreDeprecations>

Sources/ComposableArchitecture/Reducer/AnyReducer/AnyReducer.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ public struct AnyReducer<State, Action, Environment> {
451451

452452
/// This API has been soft-deprecated in favor of
453453
/// ``ReducerProtocol/ifCaseLet(_:action:then:file:fileID:line:)`` and
454-
/// ``Scope/init(state:action:_:file:fileID:line:)``. Read <doc:MigratingToTheReducerProtocol>
454+
/// ``Scope/init(state:action:child:file:fileID:line:)``. Read <doc:MigratingToTheReducerProtocol>
455455
/// for more information.
456456
///
457457
/// Transforms a reducer that works on child state, action, and environment into one that works on
@@ -942,7 +942,7 @@ public struct AnyReducer<State, Action, Environment> {
942942
}
943943

944944
/// This API has been soft-deprecated in favor of
945-
/// ``ReducerProtocol/forEach(_:action:_:file:fileID:line:)``. Read
945+
/// ``ReducerProtocol/forEach(_:action:element:file:fileID:line:)``. Read
946946
/// <doc:MigratingToTheReducerProtocol> for more information.
947947
///
948948
/// A version of ``pullback(state:action:environment:)`` that transforms a reducer that works on

Sources/ComposableArchitecture/Reducer/Reducers/DebugReducer.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ extension ReducerProtocol {
66
///
77
/// - Parameter printer: A printer for printing debug messages.
88
/// - Returns: A reducer that prints debug messages for all received actions.
9+
#if swift(>=5.8)
10+
@_documentation(visibility: public)
11+
#endif
912
@inlinable
1013
public func _printChanges(
1114
_ printer: _ReducerPrinter<State, Action>? = .customDump

Sources/ComposableArchitecture/Reducer/Reducers/Scope.swift

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
/// ```
3030
///
3131
/// A parent reducer with a domain that holds onto the child domain can use
32-
/// ``init(state:action:_:)`` to embed the child reducer in its
32+
/// ``init(state:action:child:)`` to embed the child reducer in its
3333
/// ``ReducerProtocol/body-swift.property-7foai``:
3434
///
3535
/// ```swift
@@ -58,7 +58,7 @@
5858
/// ## Enum state
5959
///
6060
/// The ``Scope`` reducer also works when state is modeled as an enum, not just a struct. In that
61-
/// case you can use ``init(state:action:_:file:fileID:line:)`` to specify a case path that
61+
/// case you can use ``init(state:action:child:file:fileID:line:)`` to specify a case path that
6262
/// identifies the case of state you want to scope to.
6363
///
6464
/// For example, if your state was modeled as an enum for unloaded/loading/loaded, you could
@@ -96,7 +96,8 @@
9696
/// For an alternative to using ``Scope`` with state case paths that enforces the order, check out
9797
/// the ``ifCaseLet(_:action:then:file:fileID:line:)`` operator.
9898
public struct Scope<ParentState, ParentAction, Child: ReducerProtocol>: ReducerProtocol {
99-
public enum StatePath {
99+
@usableFromInline
100+
enum StatePath {
100101
case casePath(
101102
CasePath<ParentState, Child.State>,
102103
file: StaticString,
@@ -106,9 +107,14 @@ public struct Scope<ParentState, ParentAction, Child: ReducerProtocol>: ReducerP
106107
case keyPath(WritableKeyPath<ParentState, Child.State>)
107108
}
108109

109-
public let toChildState: StatePath
110-
public let toChildAction: CasePath<ParentAction, Child.Action>
111-
public let child: Child
110+
@usableFromInline
111+
let toChildState: StatePath
112+
113+
@usableFromInline
114+
let toChildAction: CasePath<ParentAction, Child.Action>
115+
116+
@usableFromInline
117+
let child: Child
112118

113119
@usableFromInline
114120
init(

Sources/ComposableArchitecture/Store.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,10 @@ import Foundation
116116
/// #### Thread safety checks
117117
///
118118
/// The store performs some basic thread safety checks in order to help catch mistakes. Stores
119-
/// constructed via the initializer ``init(initialState:reducer:)`` are assumed to run
120-
/// only on the main thread, and so a check is executed immediately to make sure that is the case.
121-
/// Further, all actions sent to the store and all scopes (see ``scope(state:action:)``) of the
122-
/// store are also checked to make sure that work is performed on the main thread.
119+
/// constructed via the initializer ``init(initialState:reducer:prepareDependencies:)`` are assumed
120+
/// to run only on the main thread, and so a check is executed immediately to make sure that is the
121+
/// case. Further, all actions sent to the store and all scopes (see ``scope(state:action:)``) of
122+
/// the store are also checked to make sure that work is performed on the main thread.
123123
public final class Store<State, Action> {
124124
private var bufferedActions: [Action] = []
125125
@_spi(Internals) public var effectCancellables: [UUID: AnyCancellable] = [:]

Sources/ComposableArchitecture/SwiftUI/ForEachStore.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ import SwiftUI
5454
/// }
5555
/// ```
5656
///
57-
/// Enhance its core reducer using ``ReducerProtocol/forEach(_:action:_:file:fileID:line:)``:
57+
/// Enhance its core reducer using ``ReducerProtocol/forEach(_:action:element:file:fileID:line:)``:
5858
///
5959
/// ```swift
6060
/// var body: some ReducerProtocol<State, Action> {

Sources/ComposableArchitecture/SwiftUI/SwitchStore.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ import SwiftUI
5151
/// ```
5252
///
5353
/// See ``ReducerProtocol/ifCaseLet(_:action:then:file:fileID:line:)`` and
54-
/// ``Scope/init(state:action:_:file:fileID:line:)`` for embedding reducers that operate on each
54+
/// ``Scope/init(state:action:child:file:fileID:line:)`` for embedding reducers that operate on each
5555
/// case of an enum in reducers that operate on the entire enum.
5656
public struct SwitchStore<State, Action, Content: View>: View {
5757
public let store: Store<State, Action>

Sources/ComposableArchitecture/TestStore.swift

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,7 +1043,9 @@ extension TestStore where ScopedState: Equatable {
10431043
let previousState = self.reducer.state
10441044
let task = self.store
10451045
.send(.init(origin: .send(self.fromScopedAction(action)), file: file, line: line))
1046-
await self.reducer.effectDidSubscribe.stream.first(where: { _ in true })
1046+
for await _ in self.reducer.effectDidSubscribe.stream {
1047+
break
1048+
}
10471049
do {
10481050
let currentState = self.state
10491051
self.reducer.state = previousState
@@ -1454,7 +1456,7 @@ extension TestStore where ScopedState: Equatable, Action: Equatable {
14541456
extension TestStore where ScopedState: Equatable {
14551457
/// Asserts a matching action was received from an effect and asserts how the state changes.
14561458
///
1457-
/// See ``receive(_:timeout:assert:file:line:)-3myco`` for more information of how to use this
1459+
/// See ``receive(_:timeout:assert:file:line:)-2ju31`` for more information of how to use this
14581460
/// method.
14591461
///
14601462
/// - Parameters:
@@ -1491,7 +1493,7 @@ extension TestStore where ScopedState: Equatable {
14911493

14921494
/// Asserts an action was received matching a case path and asserts how the state changes.
14931495
///
1494-
/// See ``receive(_:timeout:assert:file:line:)-4e4m0`` for more information of how to use this
1496+
/// See ``receive(_:timeout:assert:file:line:)-8xkqt`` for more information of how to use this
14951497
/// method.
14961498
///
14971499
/// - Parameters:
@@ -1601,7 +1603,7 @@ extension TestStore where ScopedState: Equatable {
16011603
/// was in the effect that you chose not to assert on.
16021604
///
16031605
/// If you only want to check that a particular action case was received, then you might find the
1604-
/// ``receive(_:timeout:assert:file:line:)-4e4m0`` overload of this method more useful.
1606+
/// ``receive(_:timeout:assert:file:line:)-8xkqt`` overload of this method more useful.
16051607
///
16061608
/// - Parameters:
16071609
/// - isMatching: A closure that attempts to match an action. If it returns `false`, a test
@@ -2402,7 +2404,9 @@ public enum Exhaustivity: Equatable {
24022404
/// ``TestStore/skipInFlightEffects(strict:file:line:)-5hbsk``.
24032405
///
24042406
/// To partially match an action received from an effect, use
2405-
/// ``TestStore/receive(_:timeout:assert:file:line:)-4e4m0``.
2407+
/// ``TestStore/receive(_:timeout:assert:file:line:)-8xkqt`` or
2408+
/// ``TestStore/receive(_:timeout:assert:file:line:)-2ju31``.
2409+
24062410
case on
24072411

24082412
/// Non-exhaustive assertions.

0 commit comments

Comments
 (0)