From 2d8a80dbc42638fb7fd199273aaddc28178d8b91 Mon Sep 17 00:00:00 2001 From: Brandon Williams Date: Wed, 13 Nov 2024 09:48:33 -0500 Subject: [PATCH 1/2] Add migration guide for 1.16. --- README.md | 3 +- .../Articles/MigrationGuides.md | 1 + .../MigrationGuides/MigratingTo1.16.md | 32 ++++++ .../MigrationGuides/MigratingTo1.4.md | 2 +- .../MigrationGuides/MigratingTo1.7.md | 6 +- .../Articles/SharingState.md | 8 +- .../Extensions/AppStorageKey.md | 34 +++---- .../Deprecations/ReducerDeprecations.md | 2 +- .../Documentation.docc/Extensions/Reducer.md | 2 +- .../Extensions/ReducerForEach.md | 2 +- .../Documentation.docc/Extensions/Shared.md | 13 ++- .../Extensions/SharedReader.md | 9 +- .../Extensions/StoreState.md | 5 +- .../Extensions/TestStoreDependencies.md | 2 +- .../Extensions/TestStoreExhaustivity.md | 2 +- .../Documentation.docc/Extensions/UIKit.md | 2 +- Sources/ComposableArchitecture/Effect.swift | 6 +- .../IdentifiedArray+Observation.swift | 4 + .../NavigationStack+Observation.swift | 8 ++ .../Observation/Store+Observation.swift | 16 +++ .../Reducer/Reducers/ForEachReducer.swift | 6 +- .../Reducer/Reducers/IfCaseLetReducer.swift | 4 + .../Reducer/Reducers/IfLetReducer.swift | 4 + .../Reducer/Reducers/OnChange.swift | 8 +- .../Reducers/PresentationReducer.swift | 4 + .../Reducer/Reducers/Scope.swift | 12 ++- .../Reducer/Reducers/StackReducer.swift | 4 + .../PersistenceKey/AppStorageKeyPathKey.swift | 4 +- .../References/ValueReference.swift | 24 ++++- .../SharedState/Shared.swift | 2 + .../SwiftUI/Binding.swift | 9 +- .../SwiftUI/ForEachStore.swift | 2 +- .../SwiftUI/NavigationStackStore.swift | 12 ++- .../SwiftUI/SwitchStore.swift | 4 + .../SwiftUI/WithViewStore.swift | 8 ++ .../ComposableArchitecture/TestStore.swift | 98 +++++++++++++++++-- 36 files changed, 295 insertions(+), 69 deletions(-) create mode 100644 Sources/ComposableArchitecture/Documentation.docc/Articles/MigrationGuides/MigratingTo1.16.md diff --git a/README.md b/README.md index 4ab5de70d9b1..b3d4913f88f8 100644 --- a/README.md +++ b/README.md @@ -532,13 +532,14 @@ advanced usages. The documentation for releases and `main` are available here: * [`main`](https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/) -* [1.15.0](https://pointfreeco.github.io/swift-composable-architecture/1.15.0/documentation/composablearchitecture/) ([migration guide](https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/migratingto1.15)) +* [1.16.0](https://pointfreeco.github.io/swift-composable-architecture/1.16.0/documentation/composablearchitecture/) ([migration guide](https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/migratingto1.16))
Other versions +* [1.15.0](https://pointfreeco.github.io/swift-composable-architecture/1.15.0/documentation/composablearchitecture/) ([migration guide](https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/migratingto1.15)) * [1.14.0](https://pointfreeco.github.io/swift-composable-architecture/1.14.0/documentation/composablearchitecture/) ([migration guide](https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/migratingto1.14)) * [1.13.0](https://pointfreeco.github.io/swift-composable-architecture/1.13.0/documentation/composablearchitecture/) ([migration guide](https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/migratingto1.13)) * [1.12.0](https://pointfreeco.github.io/swift-composable-architecture/1.12.0/documentation/composablearchitecture/) ([migration guide](https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/migratingto1.12)) diff --git a/Sources/ComposableArchitecture/Documentation.docc/Articles/MigrationGuides.md b/Sources/ComposableArchitecture/Documentation.docc/Articles/MigrationGuides.md index 156086e9b0ef..e9e2773d446d 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Articles/MigrationGuides.md +++ b/Sources/ComposableArchitecture/Documentation.docc/Articles/MigrationGuides.md @@ -14,6 +14,7 @@ APIs, and these guides contain tips to do so. ## Topics +- - - - diff --git a/Sources/ComposableArchitecture/Documentation.docc/Articles/MigrationGuides/MigratingTo1.16.md b/Sources/ComposableArchitecture/Documentation.docc/Articles/MigrationGuides/MigratingTo1.16.md new file mode 100644 index 000000000000..43613c7a48ae --- /dev/null +++ b/Sources/ComposableArchitecture/Documentation.docc/Articles/MigrationGuides/MigratingTo1.16.md @@ -0,0 +1,32 @@ +# Migrating to 1.16 + +The `.appStorage` strategy used with `@Shared` now uses key-value observing instead of +`NotificationCenter` when possible. Learn how this may affect your code. + +## Overview + +There are no steps needed to migrate to 1.16 of the Composable Architecture, but there has been +a change to the underlying behavior of `.appStorage` that one should be aware of. When using +`.appStorage` with `@Shared`, if your key does not contain the characters "." or "@", then changes +to that key in `UserDefaults` will be observed using key-value observing (KVO). +Otherwise, `NotificationCenter` will be used to observe changes. + +KVO is a far more efficient way of observing changes to `UserDefaults` and it works cross-process, +such as from widgets and app extensions. However, KVO does not work when the keys contain "." +or "@", and so in those cases we must use the cruder tool of `NotificationCenter`. That is not +as efficient, and it forces us to perform a thread-hop when the notification is posted before +we can update the `@Shared` value. For this reason it is not possible to animate changes that are +made directly to `UserDefaults`: + +```swift +withAnimation { + // ⚠️ This will not animate any SwiftUI views using '@Shared(.appStorage("co.pointfree.count"))' + UserDefaults.standard.set(0, forKey: "co.pointfree.count") +} +``` + +In general, we recommend using other delimeters for your keys, such as "/", ":", "-", etc.: + +```swift +@Shared(.appStorage("co:pointfree:count")) var count = 0 +``` diff --git a/Sources/ComposableArchitecture/Documentation.docc/Articles/MigrationGuides/MigratingTo1.4.md b/Sources/ComposableArchitecture/Documentation.docc/Articles/MigrationGuides/MigratingTo1.4.md index 26ef537c3f28..acb19f7d20b4 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Articles/MigrationGuides/MigratingTo1.4.md +++ b/Sources/ComposableArchitecture/Documentation.docc/Articles/MigrationGuides/MigratingTo1.4.md @@ -279,7 +279,7 @@ enum Action { ``` And in the reducer, instead of invoking -``Reducer/forEach(_:action:element:fileID:filePath:line:column:)-3dw7i`` with a case path using the +``Reducer/forEach(_:action:element:fileID:filePath:line:column:)-6zye8`` with a case path using the `/` prefix operator: ```swift diff --git a/Sources/ComposableArchitecture/Documentation.docc/Articles/MigrationGuides/MigratingTo1.7.md b/Sources/ComposableArchitecture/Documentation.docc/Articles/MigrationGuides/MigratingTo1.7.md index bfbe8fd03c2a..7f34ea5338d7 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Articles/MigrationGuides/MigratingTo1.7.md +++ b/Sources/ComposableArchitecture/Documentation.docc/Articles/MigrationGuides/MigratingTo1.7.md @@ -904,7 +904,7 @@ func viewDidLoad() { } ``` -This can now be done more simply using the ``ObjectiveC/NSObject/observe(_:)`` method defined on +This can now be done more simply using the ``ObjectiveC/NSObject/observe(_:)-94oxy`` method defined on all `NSObject`s: ```swift @@ -920,7 +920,7 @@ func viewDidLoad() { } ``` -Be sure to read the documentation for ``ObjectiveC/NSObject/observe(_:)`` to learn how to best +Be sure to read the documentation for ``ObjectiveC/NSObject/observe(_:)-94oxy`` to learn how to best wield this tool. ### Replacing Store.ifLet @@ -940,7 +940,7 @@ store ``` This can now be done more simply using the `observe` method and -``Store/scope(state:action:fileID:filePath:line:column:)-2ck1n``: +``Store/scope(state:action:fileID:filePath:line:column:)-3yvuf``: ```swift observe { diff --git a/Sources/ComposableArchitecture/Documentation.docc/Articles/SharingState.md b/Sources/ComposableArchitecture/Documentation.docc/Articles/SharingState.md index 2d5de8bde212..f831be22249c 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Articles/SharingState.md +++ b/Sources/ComposableArchitecture/Documentation.docc/Articles/SharingState.md @@ -318,7 +318,7 @@ should take a plain, non-`Shared` value and you construct the `Shared` value in * You are using a persistence strategy with shared state (_e.g._ ``PersistenceReaderKey/appStorage(_:)-4l5b``, ``PersistenceReaderKey/fileStorage(_:decoder:encoder:)``, _etc._), then the initializer should take a plain, non-`Shared` value and you construct the `Shared` value in -the initializer using ``Shared/init(wrappedValue:_:fileID:line:)-512rh`` which takes a +the initializer using ``Shared/init(wrappedValue:_:fileID:line:)-9kfmy`` which takes a ``PersistenceKey`` as the second argument: ```swift @@ -338,7 +338,7 @@ the initializer using ``Shared/init(wrappedValue:_:fileID:line:)-512rh`` which t > Important: The value passed to this initializer is only used if the external storage does not > already have a value. If a value exists in the storage then it is not used. In fact, the - > `wrappedValue` argument of ``Shared/init(wrappedValue:_:fileID:line:)-512rh`` is an + > `wrappedValue` argument of ``Shared/init(wrappedValue:_:fileID:line:)-9kfmy`` is an > `@autoclosure` so that it is not even evaluated if not used. For that reason you > may prefer to make the argument to the initializer an `@autoclosure` so that it too is evaluated > only if actually used: @@ -436,7 +436,7 @@ responsible for persisting and deriving shared state to pass to the child. If your shared state is a collection, and in particular an `IdentifiedArray`, then we have another tool for deriving shared state to a particular element of the array. You can subscript into a ``Shared`` collection with the `[id:]` subscript, and that will give a piece of optional shared -state (thanks to a dynamic member overload ``Shared/subscript(dynamicMember:)-7ibhr``), which you +state (thanks to a dynamic member overload ``Shared/subscript(dynamicMember:)-9xw64``), which you can then unwrap to turn into honest shared state: ```swift @@ -1071,7 +1071,7 @@ own implementations of `encode(to:)` and `init(from:)` that do the appropriate t For example, if the data type is sharing state with a persistence strategy, you can decode by delegating to the memberwise initializer that implicitly loads the shared value from the property wrapper's persistence strategy, or you can explicitly initialize a shared value via -``Shared/init(wrappedValue:_:fileID:line:)-512rh``. And for encoding you can often skip encoding +``Shared/init(wrappedValue:_:fileID:line:)-9kfmy``. And for encoding you can often skip encoding the shared value: ```swift diff --git a/Sources/ComposableArchitecture/Documentation.docc/Extensions/AppStorageKey.md b/Sources/ComposableArchitecture/Documentation.docc/Extensions/AppStorageKey.md index 12c12fc5cd01..18f7749b9575 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Extensions/AppStorageKey.md +++ b/Sources/ComposableArchitecture/Documentation.docc/Extensions/AppStorageKey.md @@ -4,29 +4,29 @@ ### Storing a value -- ``PersistenceReaderKey/appStorage(_:)-4l5b`` -- ``PersistenceReaderKey/appStorage(_:)-6d47p`` -- ``PersistenceReaderKey/appStorage(_:)-6tsph`` -- ``PersistenceReaderKey/appStorage(_:)-69h4r`` -- ``PersistenceReaderKey/appStorage(_:)-xphy`` -- ``PersistenceReaderKey/appStorage(_:)-617ld`` -- ``PersistenceReaderKey/appStorage(_:)-6lnxu`` -- ``PersistenceReaderKey/appStorage(_:)-ibg0`` +- ``PersistenceReaderKey/appStorage(_:)-4l5b`` +- ``PersistenceReaderKey/appStorage(_:)-6d47p`` +- ``PersistenceReaderKey/appStorage(_:)-6tsph`` +- ``PersistenceReaderKey/appStorage(_:)-69h4r`` +- ``PersistenceReaderKey/appStorage(_:)-xphy`` +- ``PersistenceReaderKey/appStorage(_:)-617ld`` +- ``PersistenceReaderKey/appStorage(_:)-6k27r`` +- ``PersistenceReaderKey/appStorage(_:)-m54v`` ### Storing an optional value -- ``PersistenceReaderKey/appStorage(_:)-4s3s5`` -- ``PersistenceReaderKey/appStorage(_:)-2dfnh`` -- ``PersistenceReaderKey/appStorage(_:)-5wv8g`` -- ``PersistenceReaderKey/appStorage(_:)-40e42`` -- ``PersistenceReaderKey/appStorage(_:)-4veqp`` -- ``PersistenceReaderKey/appStorage(_:)-7rox5`` -- ``PersistenceReaderKey/appStorage(_:)-2keyn`` -- ``PersistenceReaderKey/appStorage(_:)-7u49u`` +- ``PersistenceReaderKey/appStorage(_:)-4s3s5`` +- ``PersistenceReaderKey/appStorage(_:)-2dfnh`` +- ``PersistenceReaderKey/appStorage(_:)-5wv8g`` +- ``PersistenceReaderKey/appStorage(_:)-40e42`` +- ``PersistenceReaderKey/appStorage(_:)-4veqp`` +- ``PersistenceReaderKey/appStorage(_:)-7rox5`` +- ``PersistenceReaderKey/appStorage(_:)-2cfq9`` +- ``PersistenceReaderKey/appStorage(_:)-9j150`` ### Key-path access -- ``PersistenceReaderKey/appStorage(_:)-5jsie`` +- ``PersistenceReaderKey/appStorage(_:)-69h4r`` - ``AppStorageKeyPathKey`` ### Overriding app storage diff --git a/Sources/ComposableArchitecture/Documentation.docc/Extensions/Deprecations/ReducerDeprecations.md b/Sources/ComposableArchitecture/Documentation.docc/Extensions/Deprecations/ReducerDeprecations.md index 49940d05c9bf..1f180f3672c9 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Extensions/Deprecations/ReducerDeprecations.md +++ b/Sources/ComposableArchitecture/Documentation.docc/Extensions/Deprecations/ReducerDeprecations.md @@ -15,7 +15,7 @@ instead. - ``Reducer/ifLet(_:action:destination:fileID:filePath:line:column:)-5y8z4`` - ``Reducer/ifLet(_:action:fileID:filePath:line:column:)-12kry`` - ``Reducer/ifCaseLet(_:action:then:fileID:filePath:line:column:)-403y9`` -- ``Reducer/forEach(_:action:element:fileID:filePath:line:column:)-1oguc`` +- ``Reducer/forEach(_:action:element:fileID:filePath:line:column:)-o1gn`` - ``Reducer/forEach(_:action:destination:fileID:filePath:line:column:)-74erx`` - ``Reducer/onChange(of:removeDuplicates:_:)`` diff --git a/Sources/ComposableArchitecture/Documentation.docc/Extensions/Reducer.md b/Sources/ComposableArchitecture/Documentation.docc/Extensions/Reducer.md index de642115775f..5c1a26bac4d1 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Extensions/Reducer.md +++ b/Sources/ComposableArchitecture/Documentation.docc/Extensions/Reducer.md @@ -581,7 +581,7 @@ xcodebuild -skipMacroValidation … - ``Scope`` - ``ifLet(_:action:then:fileID:filePath:line:column:)-2r2pn`` - ``ifCaseLet(_:action:then:fileID:filePath:line:column:)-7sg8d`` -- ``forEach(_:action:element:fileID:filePath:line:column:)-3dw7i`` +- ``forEach(_:action:element:fileID:filePath:line:column:)-6zye8`` - ### Sharing state diff --git a/Sources/ComposableArchitecture/Documentation.docc/Extensions/ReducerForEach.md b/Sources/ComposableArchitecture/Documentation.docc/Extensions/ReducerForEach.md index b133585a11ab..7eaec7ee8fa0 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Extensions/ReducerForEach.md +++ b/Sources/ComposableArchitecture/Documentation.docc/Extensions/ReducerForEach.md @@ -1,4 +1,4 @@ -# ``ComposableArchitecture/Reducer/forEach(_:action:element:fileID:filePath:line:column:)-3dw7i`` +# ``ComposableArchitecture/Reducer/forEach(_:action:element:fileID:filePath:line:column:)-6zye8`` ## Topics diff --git a/Sources/ComposableArchitecture/Documentation.docc/Extensions/Shared.md b/Sources/ComposableArchitecture/Documentation.docc/Extensions/Shared.md index ee08b5fdd77f..ced8205c5144 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Extensions/Shared.md +++ b/Sources/ComposableArchitecture/Documentation.docc/Extensions/Shared.md @@ -10,19 +10,22 @@ ### Creating a persisted value -- ``init(wrappedValue:_:fileID:line:)-512rh`` -- ``init(wrappedValue:_:fileID:line:)-7a80y`` +- ``init(wrappedValue:_:fileID:line:)-9kfmy`` +- ``init(wrappedValue:_:fileID:line:)-7ndwc`` - ``init(_:fileID:line:)-8zcy1`` - ``init(_:fileID:line:)-8jqg5`` -- ``init(_:fileID:line:)-gluj`` +- ``init(_:fileID:line:)-9d3q`` +- ``init(_:fileID:line:)-1q6ev`` ### Accessing the value - ``wrappedValue`` - ``projectedValue`` - ``reader`` -- ``subscript(dynamicMember:)-6kmzm`` -- ``subscript(dynamicMember:)-22ga9`` +- ``subscript(dynamicMember:)-6dq81`` +- ``subscript(dynamicMember:)-7n9xc`` +- ``subscript(dynamicMember:)-6f2x`` +- ``subscript(dynamicMember:)-9xw64`` ### Isolating the value diff --git a/Sources/ComposableArchitecture/Documentation.docc/Extensions/SharedReader.md b/Sources/ComposableArchitecture/Documentation.docc/Extensions/SharedReader.md index 79ae341e5d57..bcac6b355642 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Extensions/SharedReader.md +++ b/Sources/ComposableArchitecture/Documentation.docc/Extensions/SharedReader.md @@ -11,17 +11,18 @@ ### Creating a persisted value -- ``init(wrappedValue:_:fileID:line:)-7q52`` -- ``init(wrappedValue:_:fileID:line:)-6asu2`` +- ``init(wrappedValue:_:fileID:line:)-7f68o`` +- ``init(wrappedValue:_:fileID:line:)-galu`` - ``init(_:fileID:line:)-41rb8`` - ``init(_:fileID:line:)-3lxyf`` -- ``init(_:fileID:line:)-hzp`` +- ``init(_:fileID:line:)-5bxk6`` ### Getting the value - ``wrappedValue`` - ``projectedValue`` -- ``subscript(dynamicMember:)-34wfb`` +- ``subscript(dynamicMember:)-pigs`` +- ``subscript(dynamicMember:)-2barb`` ### SwiftUI integration diff --git a/Sources/ComposableArchitecture/Documentation.docc/Extensions/StoreState.md b/Sources/ComposableArchitecture/Documentation.docc/Extensions/StoreState.md index d480edf8c9d2..d2a7c121c067 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Extensions/StoreState.md +++ b/Sources/ComposableArchitecture/Documentation.docc/Extensions/StoreState.md @@ -4,5 +4,6 @@ ### Writable, bindable state -- ``Store/state-3ppqv`` -- ``Store/state-7k27v`` +- ``Store/state-20w4g`` +- ``Store/state-2wgiw`` +- ``Store/state-1qxwl`` diff --git a/Sources/ComposableArchitecture/Documentation.docc/Extensions/TestStoreDependencies.md b/Sources/ComposableArchitecture/Documentation.docc/Extensions/TestStoreDependencies.md index accbfced4a48..88702d7f5778 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Extensions/TestStoreDependencies.md +++ b/Sources/ComposableArchitecture/Documentation.docc/Extensions/TestStoreDependencies.md @@ -4,5 +4,5 @@ ### Configuring exhaustivity -- ``withDependencies(_:operation:)-3x2vc`` +- ``withDependencies(_:operation:)-988rh`` - ``withDependencies(_:operation:)-61in2`` diff --git a/Sources/ComposableArchitecture/Documentation.docc/Extensions/TestStoreExhaustivity.md b/Sources/ComposableArchitecture/Documentation.docc/Extensions/TestStoreExhaustivity.md index a357671e4b46..ecd604820bd5 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Extensions/TestStoreExhaustivity.md +++ b/Sources/ComposableArchitecture/Documentation.docc/Extensions/TestStoreExhaustivity.md @@ -5,5 +5,5 @@ ### Configuring exhaustivity - ``Exhaustivity`` -- ``withExhaustivity(_:operation:)-9psu7`` +- ``withExhaustivity(_:operation:)-3fqeg`` - ``withExhaustivity(_:operation:)-1mhu4`` diff --git a/Sources/ComposableArchitecture/Documentation.docc/Extensions/UIKit.md b/Sources/ComposableArchitecture/Documentation.docc/Extensions/UIKit.md index ffafd84d5984..e73bfa637504 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Extensions/UIKit.md +++ b/Sources/ComposableArchitecture/Documentation.docc/Extensions/UIKit.md @@ -11,7 +11,7 @@ integrate into application code written in UIKit. ### Subscribing to state changes -- ``ObjectiveC/NSObject/observe(_:)`` +- ``ObjectiveC/NSObject/observe(_:)-94oxy`` - ``ObservationToken`` ### Presenting alerts and action sheets diff --git a/Sources/ComposableArchitecture/Effect.swift b/Sources/ComposableArchitecture/Effect.swift index a7c898fe2e20..35b96e520df3 100644 --- a/Sources/ComposableArchitecture/Effect.swift +++ b/Sources/ComposableArchitecture/Effect.swift @@ -77,8 +77,12 @@ extension Effect { /// - priority: Priority of the underlying task. If `nil`, the priority will come from /// `Task.currentPriority`. /// - operation: The operation to execute. - /// - catch: An error handler, invoked if the operation throws an error other than + /// - handler: An error handler, invoked if the operation throws an error other than /// `CancellationError`. + /// - fileID: The fileID. + /// - filePath: The filePath. + /// - line: The line. + /// - column: The column. /// - Returns: An effect wrapping the given asynchronous work. public static func run( priority: TaskPriority? = nil, diff --git a/Sources/ComposableArchitecture/Observation/IdentifiedArray+Observation.swift b/Sources/ComposableArchitecture/Observation/IdentifiedArray+Observation.swift index 6bcbc90e2900..4206dc1702d2 100644 --- a/Sources/ComposableArchitecture/Observation/IdentifiedArray+Observation.swift +++ b/Sources/ComposableArchitecture/Observation/IdentifiedArray+Observation.swift @@ -62,6 +62,10 @@ extension Store where State: ObservableState { /// - Parameters: /// - state: A key path to an identified array of child state. /// - action: A case key path to an identified child action. + /// - column: The column. + /// - fileID: The fileID. + /// - filePath: The filePath. + /// - line: The line. /// - Returns: An collection of stores of child state. @_disfavoredOverload public func scope( diff --git a/Sources/ComposableArchitecture/Observation/NavigationStack+Observation.swift b/Sources/ComposableArchitecture/Observation/NavigationStack+Observation.swift index 936ecee9d31c..a19bd76964cc 100644 --- a/Sources/ComposableArchitecture/Observation/NavigationStack+Observation.swift +++ b/Sources/ComposableArchitecture/Observation/NavigationStack+Observation.swift @@ -230,6 +230,10 @@ extension NavigationLink where Destination == Never { /// - state: An optional value to present. When the user selects the link, SwiftUI stores a /// copy of the value. Pass a `nil` value to disable the link. /// - label: A label that describes the view that this link presents. + /// - fileID: The fileID. + /// - filePath: The filePath. + /// - line: The line. + /// - column: The column. #if compiler(>=6) @MainActor #endif @@ -269,6 +273,8 @@ extension NavigationLink where Destination == Never { /// presents. /// - state: An optional value to present. When the user selects the link, SwiftUI stores a /// copy of the value. Pass a `nil` value to disable the link. + /// - fileID: The fileID. + /// - line: The line. #if compiler(>=6) @MainActor #endif @@ -292,6 +298,8 @@ extension NavigationLink where Destination == Never { /// - title: A string that describes the view that this link presents. /// - state: An optional value to present. When the user selects the link, SwiftUI stores a /// copy of the value. Pass a `nil` value to disable the link. + /// - fileID: The fileID. + /// - line: The line. #if compiler(>=6) @MainActor #endif diff --git a/Sources/ComposableArchitecture/Observation/Store+Observation.swift b/Sources/ComposableArchitecture/Observation/Store+Observation.swift index 6b1ee73b2f91..996e077a334a 100644 --- a/Sources/ComposableArchitecture/Observation/Store+Observation.swift +++ b/Sources/ComposableArchitecture/Observation/Store+Observation.swift @@ -75,6 +75,10 @@ extension Store where State: ObservableState { /// - Parameters: /// - state: A key path to optional child state. /// - action: A case key path to child actions. + /// - fileID: The fileID. + /// - filePath: The filePath. + /// - line: The line. + /// - column: The column. /// - Returns: An optional store of non-optional child state and actions. public func scope( state: KeyPath, @@ -153,6 +157,10 @@ extension Binding { /// - Parameters: /// - state: A key path to optional child state. /// - action: A case key path to presentation child actions. + /// - fileID: The fileID. + /// - filePath: The filePath. + /// - line: The line. + /// - column: The column. /// - Returns: A binding of an optional child store. #if swift(>=5.10) @preconcurrency@MainActor @@ -228,6 +236,10 @@ extension SwiftUI.Bindable { /// - Parameters: /// - state: A key path to optional child state. /// - action: A case key path to presentation child actions. + /// - fileID: The fileID. + /// - filePath: The filePath. + /// - line: The line. + /// - column: The column. /// - Returns: A binding of an optional child store. #if swift(>=5.10) @preconcurrency@MainActor @@ -306,6 +318,10 @@ extension Perception.Bindable { /// - Parameters: /// - state: A key path to optional child state. /// - action: A case key path to presentation child actions. + /// - fileID: The fileID. + /// - filePath: The filePath. + /// - line: The line. + /// - column: The column. /// - Returns: A binding of an optional child store. public func scope( state: KeyPath, diff --git a/Sources/ComposableArchitecture/Reducer/Reducers/ForEachReducer.swift b/Sources/ComposableArchitecture/Reducer/Reducers/ForEachReducer.swift index bf1cb3241403..db834c4f3075 100644 --- a/Sources/ComposableArchitecture/Reducer/Reducers/ForEachReducer.swift +++ b/Sources/ComposableArchitecture/Reducer/Reducers/ForEachReducer.swift @@ -3,7 +3,7 @@ import OrderedCollections /// A wrapper type for actions that can be presented in a list. /// /// Use this type for modeling a feature's domain that needs to present child features using -/// ``Reducer/forEach(_:action:element:fileID:filePath:line:column:)-3dw7i``. +/// ``Reducer/forEach(_:action:element:fileID:filePath:line:column:)-6zye8``. public enum IdentifiedAction: CasePathable { /// An action sent to the element at a given identifier. case element(id: ID, action: Action) @@ -110,6 +110,10 @@ extension Reducer { /// actions. /// - element: A reducer that will be invoked with child actions against elements of child /// state. + /// - fileID: The fileID. + /// - filePath: The filePath. + /// - line: The line. + /// - column: The column. /// - Returns: A reducer that combines the child reducer with the parent reducer. @inlinable @warn_unqualified_access diff --git a/Sources/ComposableArchitecture/Reducer/Reducers/IfCaseLetReducer.swift b/Sources/ComposableArchitecture/Reducer/Reducers/IfCaseLetReducer.swift index e2d565129845..f80dafbc4982 100644 --- a/Sources/ComposableArchitecture/Reducer/Reducers/IfCaseLetReducer.swift +++ b/Sources/ComposableArchitecture/Reducer/Reducers/IfCaseLetReducer.swift @@ -49,6 +49,10 @@ extension Reducer { /// - toCaseAction: A case path from parent action to a case containing child actions. /// - case: A reducer that will be invoked with child actions against child state when it is /// present + /// - fileID: The fileID. + /// - filePath: The filePath. + /// - line: The line. + /// - column: The column. /// - Returns: A reducer that combines the child reducer with the parent reducer. @inlinable @warn_unqualified_access diff --git a/Sources/ComposableArchitecture/Reducer/Reducers/IfLetReducer.swift b/Sources/ComposableArchitecture/Reducer/Reducers/IfLetReducer.swift index cda154844a13..7140e933c311 100644 --- a/Sources/ComposableArchitecture/Reducer/Reducers/IfLetReducer.swift +++ b/Sources/ComposableArchitecture/Reducer/Reducers/IfLetReducer.swift @@ -49,6 +49,10 @@ extension Reducer { /// - toWrappedAction: A case path from parent action to a case containing child actions. /// - wrapped: A reducer that will be invoked with child actions against non-optional child /// state. + /// - fileID: The fileID. + /// - filePath: The filePath. + /// - line: The line. + /// - column: The column. /// - Returns: A reducer that combines the child reducer with the parent reducer. @inlinable @warn_unqualified_access diff --git a/Sources/ComposableArchitecture/Reducer/Reducers/OnChange.swift b/Sources/ComposableArchitecture/Reducer/Reducers/OnChange.swift index ff43e6f284df..283a6de301b0 100644 --- a/Sources/ComposableArchitecture/Reducer/Reducers/OnChange.swift +++ b/Sources/ComposableArchitecture/Reducer/Reducers/OnChange.swift @@ -47,8 +47,8 @@ extension Reducer { /// filtering. Return `true` from this closure to indicate that the second element is a /// duplicate of the first. /// - reducer: A reducer builder closure to run when the value changes. - /// - oldValue: The old value that failed the comparison check. - /// - newValue: The new value that failed the comparison check. + /// - oldValue: The old value that failed the comparison check. + /// - newValue: The new value that failed the comparison check. /// - Returns: A reducer that performs the logic when the state changes. @available(*, deprecated, message: "Use 'onChange(of:)' with and equatable value, instead.") @inlinable @@ -106,8 +106,8 @@ extension Reducer { /// - Parameters: /// - toValue: A closure that returns a value from the given state. /// - reducer: A reducer builder closure to run when the value changes. - /// - oldValue: The old value that failed the comparison check. - /// - newValue: The new value that failed the comparison check. + /// - `oldValue`: The old value that failed the comparison check. + /// - `newValue`: The new value that failed the comparison check. /// - Returns: A reducer that performs the logic when the state changes. @inlinable public func onChange( diff --git a/Sources/ComposableArchitecture/Reducer/Reducers/PresentationReducer.swift b/Sources/ComposableArchitecture/Reducer/Reducers/PresentationReducer.swift index 583090ffa683..0080fa3293ca 100644 --- a/Sources/ComposableArchitecture/Reducer/Reducers/PresentationReducer.swift +++ b/Sources/ComposableArchitecture/Reducer/Reducers/PresentationReducer.swift @@ -400,6 +400,10 @@ extension Reducer { /// - toPresentationAction: A case path from parent action to a case containing child actions. /// - destination: A reducer that will be invoked with child actions against presented child /// state. + /// - fileID: The fileID. + /// - filePath: The filePath. + /// - line: The line. + /// - column: The column. /// - Returns: A reducer that combines the child reducer with the parent reducer. @warn_unqualified_access @inlinable diff --git a/Sources/ComposableArchitecture/Reducer/Reducers/Scope.swift b/Sources/ComposableArchitecture/Reducer/Reducers/Scope.swift index b46f7d830475..346713191f03 100644 --- a/Sources/ComposableArchitecture/Reducer/Reducers/Scope.swift +++ b/Sources/ComposableArchitecture/Reducer/Reducers/Scope.swift @@ -60,8 +60,8 @@ /// ## Enum state /// /// The ``Scope`` reducer also works when state is modeled as an enum, not just a struct. In that -/// case you can use ``init(state:action:child:fileID:filePath:line:column:)`` to specify a case -/// path that identifies the case of state you want to scope to. +/// case you can use ``init(state:action:child:fileID:filePath:line:column:)-9g44g`` to specify a +/// case path that identifies the case of state you want to scope to. /// /// For example, if your state was modeled as an enum for unloaded/loading/loaded, you could /// scope to the loaded case to run a reduce on only that case: @@ -97,7 +97,7 @@ /// bugs, and so we show a runtime warning in that case, and cause test failures. /// /// For an alternative to using ``Scope`` with state case paths that enforces the order, check out -/// the ``ifCaseLet(_:action:then:fileID:line:)-7zcm0`` operator. +/// the ``ifCaseLet(_:action:then:fileID:filePath:line:column:)-rdrb`` operator. public struct Scope: Reducer { @usableFromInline enum StatePath { @@ -204,7 +204,7 @@ public struct Scope: Reducer { /// > ``` /// > /// > If the parent domain contains additional logic for switching between cases of child state, - /// > prefer ``Reducer/ifCaseLet(_:action:then:fileID:line:)-3k4yb``, which better ensures that + /// > prefer ``Reducer/ifCaseLet(_:action:then:fileID:filePath:line:column:)-7sg8d``, which better ensures that /// > child logic runs _before_ any parent logic can replace child state: /// > /// > ```swift @@ -224,6 +224,10 @@ public struct Scope: Reducer { /// - toChildState: A case path from parent state to a case containing child state. /// - toChildAction: A case path from parent action to a case containing child actions. /// - child: A reducer that will be invoked with child actions against child state. + /// - fileID: The fileID. + /// - filePath: The filePath. + /// - line: The line. + /// - column: The column. @inlinable public init( state toChildState: CaseKeyPath, diff --git a/Sources/ComposableArchitecture/Reducer/Reducers/StackReducer.swift b/Sources/ComposableArchitecture/Reducer/Reducers/StackReducer.swift index bd5dc6b5293d..a6ee873586ee 100644 --- a/Sources/ComposableArchitecture/Reducer/Reducers/StackReducer.swift +++ b/Sources/ComposableArchitecture/Reducer/Reducers/StackReducer.swift @@ -369,6 +369,10 @@ extension Reducer { /// - toStackAction: A case path from parent action to a stack action. /// - destination: A reducer that will be invoked with destination actions against elements of /// destination state. + /// - fileID: The fileID. + /// - filePath: The filePath. + /// - line: The line. + /// - column: The column. /// - Returns: A reducer that combines the destination reducer with the parent reducer. @inlinable @warn_unqualified_access diff --git a/Sources/ComposableArchitecture/SharedState/PersistenceKey/AppStorageKeyPathKey.swift b/Sources/ComposableArchitecture/SharedState/PersistenceKey/AppStorageKeyPathKey.swift index 84dc174992ed..a4d2e2a748f8 100644 --- a/Sources/ComposableArchitecture/SharedState/PersistenceKey/AppStorageKeyPathKey.swift +++ b/Sources/ComposableArchitecture/SharedState/PersistenceKey/AppStorageKeyPathKey.swift @@ -12,7 +12,7 @@ extension PersistenceReaderKey { /// @Shared(.appStorage(\.appLaunchedAt)) var appLaunchedAt = Date() /// ``` /// - /// - Parameter key: A string key identifying a value to share in memory. + /// - Parameter keyPath: A string key identifying a value to share in memory. /// - Returns: A persistence key. public static func appStorage( _ keyPath: _SendableReferenceWritableKeyPath @@ -23,7 +23,7 @@ extension PersistenceReaderKey { /// A type defining a user defaults persistence strategy via key path. /// -/// See ``PersistenceReaderKey/appStorage(_:)-5jsie`` to create values of this type. +/// See ``PersistenceReaderKey/appStorage(_:)-69h4r`` to create values of this type. public struct AppStorageKeyPathKey: Sendable { private let keyPath: _SendableReferenceWritableKeyPath private let store: UncheckedSendable diff --git a/Sources/ComposableArchitecture/SharedState/References/ValueReference.swift b/Sources/ComposableArchitecture/SharedState/References/ValueReference.swift index f7561ad399a0..65fad69c2c60 100644 --- a/Sources/ComposableArchitecture/SharedState/References/ValueReference.swift +++ b/Sources/ComposableArchitecture/SharedState/References/ValueReference.swift @@ -13,6 +13,8 @@ extension Shared { /// key. /// - persistenceKey: A persistence key associated with the shared reference. It is responsible /// for loading and saving the shared reference's value from some external source. + /// - fileID: The fileID. + /// - line: The line. public init( wrappedValue value: @autoclosure @Sendable () -> Value, _ persistenceKey: some PersistenceKey, @@ -54,6 +56,8 @@ extension Shared { /// - Parameters: /// - persistenceKey: A persistence key associated with the shared reference. It is responsible /// for loading and saving the shared reference's value from some external source. + /// - fileID: The fileID. + /// - line: The line. @_disfavoredOverload public init( _ persistenceKey: some PersistenceKey, @@ -66,11 +70,13 @@ extension Shared { /// Creates a shared reference to a value using a persistence key. /// /// If the given persistence key cannot load a value, an error is thrown. For a non-throwing - /// version of this initializer, see ``init(wrappedValue:_:fileID:line:)-512rh``. + /// version of this initializer, see ``init(wrappedValue:_:fileID:line:)-9kfmy``. /// /// - Parameters: /// - persistenceKey: A persistence key associated with the shared reference. It is responsible /// for loading and saving the shared reference's value from some external source. + /// - fileID: The fileID. + /// - line: The line. @_disfavoredOverload public init( _ persistenceKey: some PersistenceKey, @@ -130,6 +136,8 @@ extension Shared { /// - Parameters: /// - persistenceKey: A persistence key associated with the shared reference. It is responsible /// for loading and saving the shared reference's value from some external source. + /// - fileID: The fileID. + /// - line: The line. public init>( _ persistenceKey: PersistenceKeyDefault, fileID: StaticString = #fileID, @@ -150,6 +158,8 @@ extension Shared { /// key. /// - persistenceKey: A persistence key associated with the shared reference. It is responsible /// for loading and saving the shared reference's value from some external source. + /// - fileID: The fileID. + /// - line: The line. public init>( wrappedValue value: @autoclosure @Sendable () -> Value, _ persistenceKey: PersistenceKeyDefault, @@ -173,6 +183,8 @@ extension SharedReader { /// key. /// - persistenceKey: A persistence key associated with the shared reference. It is responsible /// for loading the shared reference's value from some external source. + /// - fileID: The fileID. + /// - line: The line. public init( wrappedValue value: @autoclosure @Sendable () -> Value, _ persistenceKey: some PersistenceReaderKey, @@ -213,6 +225,8 @@ extension SharedReader { /// - Parameters: /// - persistenceKey: A persistence key associated with the shared reference. It is responsible /// for loading the shared reference's value from some external source. + /// - fileID: The fileID. + /// - line: The line. @_disfavoredOverload public init( _ persistenceKey: some PersistenceReaderKey, @@ -225,11 +239,13 @@ extension SharedReader { /// Creates a shared reference to a read-only value using a persistence key. /// /// If the given persistence key cannot load a value, an error is thrown. For a non-throwing - /// version of this initializer, see ``init(wrappedValue:_:fileID:line:)-7q52``. + /// version of this initializer, see ``init(wrappedValue:_:fileID:line:)-7f68o``. /// /// - Parameters: /// - persistenceKey: A persistence key associated with the shared reference. It is responsible /// for loading the shared reference's value from some external source. + /// - fileID: The fileID. + /// - line: The line. @_disfavoredOverload public init( _ persistenceKey: some PersistenceReaderKey, @@ -288,6 +304,8 @@ extension SharedReader { /// - Parameters: /// - persistenceKey: A persistence key associated with the shared reference. It is responsible /// for loading the shared reference's value from some external source. + /// - fileID: The fileID. + /// - line: The line. public init>( _ persistenceKey: PersistenceKeyDefault, fileID: StaticString = #fileID, @@ -308,6 +326,8 @@ extension SharedReader { /// key. /// - persistenceKey: A persistence key associated with the shared reference. It is responsible /// for loading the shared reference's value from some external source. + /// - fileID: The fileID. + /// - line: The line. public init>( wrappedValue value: @autoclosure @Sendable () -> Value, _ persistenceKey: PersistenceKeyDefault, diff --git a/Sources/ComposableArchitecture/SharedState/Shared.swift b/Sources/ComposableArchitecture/SharedState/Shared.swift index 170c705b9df2..db5b93955d9d 100644 --- a/Sources/ComposableArchitecture/SharedState/Shared.swift +++ b/Sources/ComposableArchitecture/SharedState/Shared.swift @@ -25,6 +25,8 @@ public struct Shared: Sendable { /// /// - Parameters: /// - value: A value to wrap. + /// - fileID: The fileID. + /// - line: The line. public init(_ value: Value, fileID: StaticString = #fileID, line: UInt = #line) { self.init( reference: ValueReference>( diff --git a/Sources/ComposableArchitecture/SwiftUI/Binding.swift b/Sources/ComposableArchitecture/SwiftUI/Binding.swift index 655fdfc42793..1df56e2ec570 100644 --- a/Sources/ComposableArchitecture/SwiftUI/Binding.swift +++ b/Sources/ComposableArchitecture/SwiftUI/Binding.swift @@ -589,7 +589,6 @@ extension ViewStore where ViewState: Equatable { /// - store: A store. /// - toViewState: A function that transforms binding store state into observable view state. /// All changes to the view state will cause the `WithViewStore` to re-compute its view. - /// - content: A function that can generate content from a view store. @_disfavoredOverload public convenience init( _ store: Store, @@ -617,6 +616,8 @@ extension WithViewStore where Content: View { /// - isDuplicate: A function to determine when two `ViewState` values are equal. When values /// are equal, repeat view computations are removed. /// - content: A function that can generate content from a view store. + /// - file: The file. + /// - line: The line. @_disfavoredOverload public init( _ store: Store, @@ -661,6 +662,8 @@ extension WithViewStore where Content: View { /// - isDuplicate: A function to determine when two `ViewState` values are equal. When values /// are equal, repeat view computations are removed. /// - content: A function that can generate content from a view store. + /// - file: The file. + /// - line: The line. @_disfavoredOverload public init( _ store: Store, @@ -694,6 +697,8 @@ extension WithViewStore where ViewState: Equatable, Content: View { /// All changes to the view state will cause the `WithViewStore` to re-compute its view. /// - fromViewAction: A function that transforms view actions into store action. /// - content: A function that can generate content from a view store. + /// - file: The file. + /// - line: The line. @_disfavoredOverload public init( _ store: Store, @@ -724,6 +729,8 @@ extension WithViewStore where ViewState: Equatable, Content: View { /// - toViewState: A function that transforms binding store state into observable view state. /// All changes to the view state will cause the `WithViewStore` to re-compute its view. /// - content: A function that can generate content from a view store. + /// - file: The file. + /// - line: The line. @_disfavoredOverload public init( _ store: Store, diff --git a/Sources/ComposableArchitecture/SwiftUI/ForEachStore.swift b/Sources/ComposableArchitecture/SwiftUI/ForEachStore.swift index 25af4c05fd25..c95bbd4512a0 100644 --- a/Sources/ComposableArchitecture/SwiftUI/ForEachStore.swift +++ b/Sources/ComposableArchitecture/SwiftUI/ForEachStore.swift @@ -61,7 +61,7 @@ import SwiftUI /// ``` /// /// Enhance its core reducer using -/// ``Reducer/forEach(_:action:element:fileID:filePath:line:column:)-3dw7i``: +/// ``Reducer/forEach(_:action:element:fileID:filePath:line:column:)-6zye8``: /// /// ```swift /// var body: some Reducer { diff --git a/Sources/ComposableArchitecture/SwiftUI/NavigationStackStore.swift b/Sources/ComposableArchitecture/SwiftUI/NavigationStackStore.swift index da053f932a15..67429cd5cf10 100644 --- a/Sources/ComposableArchitecture/SwiftUI/NavigationStackStore.swift +++ b/Sources/ComposableArchitecture/SwiftUI/NavigationStackStore.swift @@ -37,11 +37,15 @@ public struct NavigationStackStore /// Creates a navigation stack with a store of stack state and actions. /// /// - Parameters: - /// - path: A store of stack state and actions to power this stack. + /// - store: A store of stack state and actions to power this stack. /// - root: The view to display when the stack is empty. /// - destination: A view builder that defines a view to display when an element is appended to /// the stack's state. The closure takes one argument, which is a store of the value to /// present. + /// - fileID: The fileID. + /// - filePath: The filePath. + /// - line: The line. + /// - column: The column. public init( _ store: Store, StackAction>, @ViewBuilder root: () -> Root, @@ -89,11 +93,15 @@ public struct NavigationStackStore /// Creates a navigation stack with a store of stack state and actions. /// /// - Parameters: - /// - path: A store of stack state and actions to power this stack. + /// - store: A store of stack state and actions to power this stack. /// - root: The view to display when the stack is empty. /// - destination: A view builder that defines a view to display when an element is appended to /// the stack's state. The closure takes one argument, which is the initial enum state to /// present. You can switch over this value and use ``CaseLet`` views to handle each case. + /// - fileID: The fileID. + /// - filePath: The filePath. + /// - line: The line. + /// - column: The column. @_disfavoredOverload public init( _ store: Store, StackAction>, diff --git a/Sources/ComposableArchitecture/SwiftUI/SwitchStore.swift b/Sources/ComposableArchitecture/SwiftUI/SwitchStore.swift index 72a78401ca17..52fcce977486 100644 --- a/Sources/ComposableArchitecture/SwiftUI/SwitchStore.swift +++ b/Sources/ComposableArchitecture/SwiftUI/SwitchStore.swift @@ -137,6 +137,10 @@ public struct CaseLet CaseState?, action fromCaseAction: @escaping (CaseAction) -> EnumAction, diff --git a/Sources/ComposableArchitecture/SwiftUI/WithViewStore.swift b/Sources/ComposableArchitecture/SwiftUI/WithViewStore.swift index 467bda49113a..7e7df5d04210 100644 --- a/Sources/ComposableArchitecture/SwiftUI/WithViewStore.swift +++ b/Sources/ComposableArchitecture/SwiftUI/WithViewStore.swift @@ -481,6 +481,8 @@ public struct WithViewStore: View { /// - isDuplicate: A function to determine when two `ViewState` values are equal. When values /// are equal, repeat view computations are removed. /// - content: A function that can generate content from a view store. + /// - file: The file. + /// - line: The line. public init( _ store: Store, observe toViewState: @escaping (_ state: State) -> ViewState, @@ -576,6 +578,8 @@ public struct WithViewStore: View { /// - isDuplicate: A function to determine when two `ViewState` values are equal. When values /// are equal, repeat view computations are removed. /// - content: A function that can generate content from a view store. + /// - file: The file. + /// - line: The line. public init( _ store: Store, observe toViewState: @escaping (_ state: State) -> ViewState, @@ -671,6 +675,8 @@ extension WithViewStore where ViewState: Equatable, Content: View { /// changes to the view state will cause the `WithViewStore` to re-compute its view. /// - fromViewAction: A function that transforms view actions into store action. /// - content: A function that can generate content from a view store. + /// - file: The file. + /// - line: The line. public init( _ store: Store, observe toViewState: @escaping (_ state: State) -> ViewState, @@ -763,6 +769,8 @@ extension WithViewStore where ViewState: Equatable, Content: View { /// - toViewState: A function that transforms store state into observable view state. All /// changes to the view state will cause the `WithViewStore` to re-compute its view. /// - content: A function that can generate content from a view store. + /// - file: The file. + /// - line: The line. public init( _ store: Store, observe toViewState: @escaping (_ state: State) -> ViewState, diff --git a/Sources/ComposableArchitecture/TestStore.swift b/Sources/ComposableArchitecture/TestStore.swift index 5864827c3525..7c2c88d41245 100644 --- a/Sources/ComposableArchitecture/TestStore.swift +++ b/Sources/ComposableArchitecture/TestStore.swift @@ -524,6 +524,10 @@ public final class TestStore { /// - prepareDependencies: A closure that can be used to override dependencies that will be /// accessed during the test. These dependencies will be used when producing the initial /// state. + /// - fileID: The fileID. + /// - filePath: The filePath. + /// - line: The line. + /// - column: The column. public init( initialState: @autoclosure () -> State, reducer: () -> R, @@ -558,7 +562,12 @@ public final class TestStore { /// /// Can be used to assert that all effects have finished. /// - /// - Parameter duration: The amount of time to wait before asserting. + /// - Parameters: + /// - duration: The amount of time to wait before asserting. + /// - fileID: The fileID. + /// - filePath: The filePath. + /// - line: The line. + /// - column: The column. @available(iOS 16, macOS 13, tvOS 16, watchOS 9, *) public func finish( timeout duration: Duration, @@ -579,7 +588,12 @@ public final class TestStore { /// > Important: `TestStore.finish()` should only be called once per test store, at the end of the /// > test. Interacting with a finished test store is undefined. /// - /// - Parameter nanoseconds: The amount of time to wait before asserting. + /// - Parameters: + /// - nanoseconds: The amount of time to wait before asserting. + /// - fileID: The fileID. + /// - filePath: The filePath. + /// - line: The line. + /// - column: The column. @_disfavoredOverload public func finish( timeout nanoseconds: UInt64? = nil, @@ -919,6 +933,10 @@ extension TestStore where State: Equatable { /// the store. The mutable state sent to this closure must be modified to match the state of /// the store after processing the given action. Do not provide a closure if no change is /// expected. + /// - fileID: The fileID. + /// - filePath: The filePath. + /// - line: The line. + /// - column: The column. /// - Returns: A ``TestStoreTask`` that represents the lifecycle of the effect executed when /// sending the action. @discardableResult @@ -1051,6 +1069,10 @@ extension TestStore where State: Equatable { /// - Parameters: /// - updateStateToExpectedResult: A closure that asserts against the current state of the test /// store. + /// - fileID: The fileID. + /// - filePath: The filePath. + /// - line: The line. + /// - column: The column. public func assert( _ updateStateToExpectedResult: @escaping (_ state: inout State) throws -> Void, fileID: StaticString = #fileID, @@ -1320,6 +1342,10 @@ extension TestStore where State: Equatable, Action: Equatable { /// to the store. The mutable state sent to this closure must be modified to match the state /// of the store after processing the given action. Do not provide a closure if no change /// is expected. + /// - fileID: The fileID. + /// - filePath: The filePath. + /// - line: The line. + /// - column: The column. @available(iOS 16, macOS 13, tvOS 16, watchOS 9, *) public func receive( _ expectedAction: Action, @@ -1370,6 +1396,10 @@ extension TestStore where State: Equatable, Action: Equatable { /// the store. The mutable state sent to this closure must be modified to match the state of /// the store after processing the given action. Do not provide a closure if no change is /// expected. + /// - fileID: The fileID. + /// - filePath: The filePath. + /// - line: The line. + /// - column: The column. @_disfavoredOverload public func receive( _ expectedAction: Action, @@ -1537,6 +1567,10 @@ extension TestStore where State: Equatable { /// to the store. The mutable state sent to this closure must be modified to match the state /// of the store after processing the given action. Do not provide a closure if no change is /// expected. + /// - fileID: The fileID. + /// - filePath: The filePath. + /// - line: The line. + /// - column: The column. @_disfavoredOverload @available(iOS 16, macOS 13, tvOS 16, watchOS 9, *) public func receive( @@ -1592,6 +1626,10 @@ extension TestStore where State: Equatable { /// the store. The mutable state sent to this closure must be modified to match the state of /// the store after processing the given action. Do not provide a closure if no change is /// expected. + /// - fileID: The fileID. + /// - filePath: The filePath. + /// - line: The line. + /// - column: The column. @_disfavoredOverload public func receive( _ isMatching: (_ action: Action) -> Bool, @@ -1670,6 +1708,10 @@ extension TestStore where State: Equatable { /// the store. The mutable state sent to this closure must be modified to match the state of /// the store after processing the given action. Do not provide a closure if no change is /// expected. + /// - fileID: The fileID. + /// - filePath: The filePath. + /// - line: The line. + /// - column: The column. @_disfavoredOverload public func receive( _ actionCase: CaseKeyPath, @@ -1710,11 +1752,15 @@ extension TestStore where State: Equatable { /// - Parameters: /// - actionCase: A case path identifying the case of an action to enum to receive /// - value: The value to match in the action. - /// - duration: The amount of time to wait for the expected action. + /// - nanoseconds: The amount of time to wait for the expected action. /// - updateStateToExpectedResult: A closure that asserts state changed by sending the action /// to the store. The mutable state sent to this closure must be modified to match the state /// of the store after processing the given action. Do not provide a closure if no change is /// expected. + /// - fileID: The fileID. + /// - filePath: The filePath. + /// - line: The line. + /// - column: The column. @_disfavoredOverload public func receive( _ actionCase: CaseKeyPath, @@ -1869,6 +1915,10 @@ extension TestStore where State: Equatable { /// to the store. The mutable state sent to this closure must be modified to match the state /// of the store after processing the given action. Do not provide a closure if no change is /// expected. + /// - fileID: The fileID. + /// - filePath: The filePath. + /// - line: The line. + /// - column: The column. @_disfavoredOverload @available(iOS 16, macOS 13, tvOS 16, watchOS 9, *) public func receive( @@ -1915,6 +1965,10 @@ extension TestStore where State: Equatable { /// to the store. The mutable state sent to this closure must be modified to match the state /// of the store after processing the given action. Do not provide a closure if no change is /// expected. + /// - fileID: The fileID. + /// - filePath: The filePath. + /// - line: The line. + /// - column: The column. @_disfavoredOverload @available(iOS 16, macOS 13, tvOS 16, watchOS 9, *) public func receive( @@ -2217,6 +2271,10 @@ extension TestStore where State: Equatable { /// the store. The mutable state sent to this closure must be modified to match the state of /// the store after processing the given action. Do not provide a closure if no change is /// expected. + /// - fileID: The fileID. + /// - filePath: The filePath. + /// - line: The line. + /// - column: The column. /// - Returns: A ``TestStoreTask`` that represents the lifecycle of the effect executed when /// sending the action. @_disfavoredOverload @@ -2263,6 +2321,10 @@ extension TestStore where State: Equatable { /// the store. The mutable state sent to this closure must be modified to match the state of /// the store after processing the given action. Do not provide a closure if no change is /// expected. + /// - fileID: The fileID. + /// - filePath: The filePath. + /// - line: The line. + /// - column: The column. /// - Returns: A ``TestStoreTask`` that represents the lifecycle of the effect executed when /// sending the action. @_disfavoredOverload @@ -2307,8 +2369,13 @@ extension TestStore { /// await store.skipReceivedActions() /// ``` /// - /// - Parameter strict: When `true` and there are no in-flight actions to cancel, a test failure - /// will be reported. + /// - Parameters: + /// - strict: When `true` and there are no in-flight actions to cancel, a test failure + /// will be reported. + /// - fileID: The fileID. + /// - filePath: The filePath. + /// - line: The line. + /// - column: The column. public func skipReceivedActions( strict: Bool = true, fileID: StaticString = #fileID, @@ -2387,8 +2454,13 @@ extension TestStore { /// await store.skipInFlightEffects() /// ``` /// - /// - Parameter strict: When `true` and there are no in-flight actions to cancel, a test failure + /// - Parameters: + /// - strict: When `true` and there are no in-flight actions to cancel, a test failure /// will be reported. + /// - fileID: The fileID. + /// - filePath: The filePath. + /// - line: The line. + /// - column: The column. public func skipInFlightEffects( strict: Bool = true, fileID: StaticString = #fileID, @@ -2649,7 +2721,12 @@ public struct TestStoreTask: Hashable, Sendable { /// Asserts the underlying task finished. /// - /// - Parameter duration: The amount of time to wait before asserting. + /// - Parameters: + /// - duration: The amount of time to wait before asserting. + /// - fileID: The fileID. + /// - filePath: The filePath. + /// - line: The line. + /// - column: The column. @available(iOS 16, macOS 13, tvOS 16, watchOS 9, *) public func finish( timeout duration: Duration, @@ -2669,7 +2746,12 @@ public struct TestStoreTask: Hashable, Sendable { /// Asserts the underlying task finished. /// - /// - Parameter nanoseconds: The amount of time to wait before asserting. + /// - Parameters: + /// - nanoseconds: The amount of time to wait before asserting. + /// - fileID: The fileID. + /// - filePath: The filePath. + /// - line: The line. + /// - column: The column. @_disfavoredOverload public func finish( timeout nanoseconds: UInt64? = nil, From c8d91662cb5dc7da95703d397519e93b3e626c41 Mon Sep 17 00:00:00 2001 From: Stephen Celis Date: Wed, 13 Nov 2024 11:37:32 -0800 Subject: [PATCH 2/2] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b3d4913f88f8..99b2fb8a112d 100644 --- a/README.md +++ b/README.md @@ -539,7 +539,7 @@ The documentation for releases and `main` are available here: Other versions -* [1.15.0](https://pointfreeco.github.io/swift-composable-architecture/1.15.0/documentation/composablearchitecture/) ([migration guide](https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/migratingto1.15)) + * [1.15.0](https://pointfreeco.github.io/swift-composable-architecture/1.15.0/documentation/composablearchitecture/) ([migration guide](https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/migratingto1.15)) * [1.14.0](https://pointfreeco.github.io/swift-composable-architecture/1.14.0/documentation/composablearchitecture/) ([migration guide](https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/migratingto1.14)) * [1.13.0](https://pointfreeco.github.io/swift-composable-architecture/1.13.0/documentation/composablearchitecture/) ([migration guide](https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/migratingto1.13)) * [1.12.0](https://pointfreeco.github.io/swift-composable-architecture/1.12.0/documentation/composablearchitecture/) ([migration guide](https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/migratingto1.12))