Skip to content

Added reminder to use the .fetch() in the reduce() when using NumberF… #1962

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 27, 2023

Conversation

siliconsorcery
Copy link
Contributor

Small update for the documentation. This should help beginners avoid the confusion I found myself in.

@stephencelis
Copy link
Member

stephencelis commented Mar 7, 2023

@siliconsorcery Thanks for taking the time to PR! I think that code is already taken care of here, though:

Then we can use it in the `reduce` implementation:
```swift
case .numberFactButtonTapped:
return .task { [count = state.count] in
await .numberFactResponse(TaskResult { try await self.numberFact(count) })
}
```

Luckily, switching from holding onto a dependency explicitly as a property vs. implicitly through a property wrapper means the call site in reduce doesn't need to change!

@siliconsorcery
Copy link
Contributor Author

@stephencelis Thanks for your response.

Unless I missed a step, we are using a variable to hold our function to fetch a number fact. The default definition is set in:

extension NumberFactClient: DependencyKey {
  static let liveValue = Self(
    fetch: ..
 )
}

It can be overridden for testing

let store = TestStore(
  initialState: Feature.State(),
  reducer: Feature()
) {
  $0.numberFact.fetch = { "\($0) is a good number Brent" }
}

Note we are referencing the fetch function we are replacing.

Now for usage we need to call the fetch function.

        case .numberFactButtonTapped:
            return .task { [count = state.count] in
                await .numberFactResponse(
                    TaskResult {
                        try await self.numberFact.fetch(count)
                    }
                )
            }

If I omit the fetch function

  try await self.numberFact(count)

Xcode throws an error: Cannot call value of non-function type 'NumberFactClient'

This had me very confused until I studied the code.

Again, unless I missed something, I think the correct function access for all uses (production, development and testing) in this case is to call the fetch function.

  try await self.numberFact.fetch(count)

Thanks four your great work.

@stephencelis
Copy link
Member

@siliconsorcery Ah you're right. I overlooked the .fetch. Will chat with @mbrandonw about this just to see if there's a way of minimizing README steps, but good catch, thanks!

@stephencelis
Copy link
Member

@siliconsorcery Rather than add another step and more prose, what do you think of folding the required change into this code block:

```swift
struct Feature: ReducerProtocol {
struct State { }
enum Action { }
@Dependency(\.numberFact) var numberFact
}
```

Basically change it to this diff instead?

 struct Feature: ReducerProtocol {
   …
-  let numberFact: (Int) async throws -> String
+  @Dependency(\.numberFact) var numberFact-  try await self.numberFact(count)
+  try await self.numberFact.fetch(count)
   …
 }

@mbrandonw
Copy link
Member

Hi @siliconsorcery, I have made the changes that @stephencelis mentioned and think it reads better now. Will merge this and hopefully it helps people in the future.

Thanks for bringing this up!

@mbrandonw mbrandonw merged commit f94a186 into pointfreeco:main Mar 27, 2023
junebash pushed a commit to junebash/swift-composable-architecture that referenced this pull request Apr 8, 2023
pointfreeco#1962)

* Added reminder to use the .fetch() in the reduce() when using NumberFactClient

* wip

---------

Co-authored-by: Brandon Williams <[email protected]>
renovate bot referenced this pull request in cgrindel/rules_swift_package_manager Jul 6, 2023
…ure to from: "0.55.0" (#452)

[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
|
[pointfreeco/swift-composable-architecture](https://github.com/pointfreeco/swift-composable-architecture)
| minor | `from: "0.51.0"` -> `from: "0.55.0"` |

---

### Release Notes

<details>
<summary>pointfreeco/swift-composable-architecture
(pointfreeco/swift-composable-architecture)</summary>

###
[`v0.55.0`](https://github.com/pointfreeco/swift-composable-architecture/releases/tag/0.55.0)

[Compare
Source](https://github.com/pointfreeco/swift-composable-architecture/compare/0.54.1...0.55.0)

#### What's Changed

- Added: The Composable Architecture's SwiftUI bindings integration has
been greatly improved, with better support for view state bindings
([https://github.com/pointfreeco/swift-composable-architecture/pull/2215](https://github.com/pointfreeco/swift-composable-architecture/pull/2215)).
- Added: `Store.send` and `Store.withState` have been added, for sending
actions to stores and accessing store state without needing a view store
([https://github.com/pointfreeco/swift-composable-architecture/pull/2222](https://github.com/pointfreeco/swift-composable-architecture/pull/2222)).
- Added: `ReducerProtocol.onChange`
([https://github.com/pointfreeco/swift-composable-architecture/pull/2226](https://github.com/pointfreeco/swift-composable-architecture/pull/2226)).
- Added: `EffectOf<Reducer>` convenience type alias to
`EffectTask<Reducer.Action>`
([https://github.com/pointfreeco/swift-composable-architecture/pull/2237](https://github.com/pointfreeco/swift-composable-architecture/pull/2237)).
- Updated: `swiftui-navigation` has been bumped to 0.8.0
([https://github.com/pointfreeco/swift-composable-architecture/pull/2239](https://github.com/pointfreeco/swift-composable-architecture/pull/2239)).
- Improved: `TestStore` failure messages have been improved
([https://github.com/pointfreeco/swift-composable-architecture/pull/2227](https://github.com/pointfreeco/swift-composable-architecture/pull/2227),
[https://github.com/pointfreeco/swift-composable-architecture/pull/2236](https://github.com/pointfreeco/swift-composable-architecture/pull/2236)).
- Fixed: `ForEachStore` no longer force-unwraps its cached value,
avoiding crashes in race condition-heavy code (thanks
[@&#8203;ohitsdaniel](https://github.com/ohitsdaniel),
[https://github.com/pointfreeco/swift-composable-architecture/pull/1036](https://github.com/pointfreeco/swift-composable-architecture/pull/1036)).
- Fixed: Addressed a few Xcode 15 warnings (Swift 6 errors)
([https://github.com/pointfreeco/swift-composable-architecture/pull/2213](https://github.com/pointfreeco/swift-composable-architecture/pull/2213)).
- Deprecated: `Effect.cancel(ids:)` has been deprecated
([https://github.com/pointfreeco/swift-composable-architecture/pull/2221](https://github.com/pointfreeco/swift-composable-architecture/pull/2221)).
- Infrastructure: Documentation improvements (thanks
[@&#8203;ccxla](https://github.com/ccxla),
[https://github.com/pointfreeco/swift-composable-architecture/pull/2185](https://github.com/pointfreeco/swift-composable-architecture/pull/2185),
[https://github.com/pointfreeco/swift-composable-architecture/pull/2184](https://github.com/pointfreeco/swift-composable-architecture/pull/2184),
[https://github.com/pointfreeco/swift-composable-architecture/pull/2183](https://github.com/pointfreeco/swift-composable-architecture/pull/2183);
[@&#8203;tomu28](https://github.com/tomu28),
[https://github.com/pointfreeco/swift-composable-architecture/pull/2209](https://github.com/pointfreeco/swift-composable-architecture/pull/2209);
[@&#8203;alexhunsley](https://github.com/alexhunsley),
[https://github.com/pointfreeco/swift-composable-architecture/pull/2204](https://github.com/pointfreeco/swift-composable-architecture/pull/2204);
[@&#8203;oronbz](https://github.com/oronbz),
[https://github.com/pointfreeco/swift-composable-architecture/pull/2173](https://github.com/pointfreeco/swift-composable-architecture/pull/2173);
[https://github.com/pointfreeco/swift-composable-architecture/pull/2225](https://github.com/pointfreeco/swift-composable-architecture/pull/2225);
[https://github.com/pointfreeco/swift-composable-architecture/pull/2238](https://github.com/pointfreeco/swift-composable-architecture/pull/2238)).

#### New Contributors

- [@&#8203;tomu28](https://github.com/tomu28) made their first
contribution in
[https://github.com/pointfreeco/swift-composable-architecture/pull/2209](https://github.com/pointfreeco/swift-composable-architecture/pull/2209)
- [@&#8203;alexhunsley](https://github.com/alexhunsley) made their
first contribution in
[https://github.com/pointfreeco/swift-composable-architecture/pull/2204](https://github.com/pointfreeco/swift-composable-architecture/pull/2204)
- [@&#8203;ohitsdaniel](https://github.com/ohitsdaniel) made their
first contribution in
[https://github.com/pointfreeco/swift-composable-architecture/pull/1036](https://github.com/pointfreeco/swift-composable-architecture/pull/1036)

**Full Changelog**:
pointfreeco/swift-composable-architecture@0.54.1...0.55.0

###
[`v0.54.1`](https://github.com/pointfreeco/swift-composable-architecture/releases/tag/0.54.1)

[Compare
Source](https://github.com/pointfreeco/swift-composable-architecture/compare/0.54.0...0.54.1)

#### What's Changed

- Fixed: A regression introduced in 0.54.0 prevented some Composable
Architecture projects from building in release due to a Swift compiler
bug. We have removed some `@inlineable` attributes to work around this
bug
([https://github.com/pointfreeco/swift-composable-architecture/pull/2201](https://github.com/pointfreeco/swift-composable-architecture/pull/2201)).
While we don't anticipate noticeable runtime performance regressions in
release builds of applications, please report any issues you may see.
- Infrastructure: Added Hindi (Indian) translation of README.md (thanks
[@&#8203;akashsoni01](https://github.com/akashsoni01),
[https://github.com/pointfreeco/swift-composable-architecture/pull/2171](https://github.com/pointfreeco/swift-composable-architecture/pull/2171))
- Infrastructure: Documentation updates and fixes (thanks
[@&#8203;Sajjon](https://github.com/Sajjon),
[https://github.com/pointfreeco/swift-composable-architecture/pull/2150](https://github.com/pointfreeco/swift-composable-architecture/pull/2150);
[@&#8203;tatsuz0u](https://github.com/tatsuz0u),
[https://github.com/pointfreeco/swift-composable-architecture/pull/2155](https://github.com/pointfreeco/swift-composable-architecture/pull/2155);
[@&#8203;hmhv](https://github.com/hmhv),
[https://github.com/pointfreeco/swift-composable-architecture/pull/2152](https://github.com/pointfreeco/swift-composable-architecture/pull/2152);
[@&#8203;MarshalGeazipp](https://github.com/MarshalGeazipp),
[https://github.com/pointfreeco/swift-composable-architecture/pull/2154](https://github.com/pointfreeco/swift-composable-architecture/pull/2154);
[@&#8203;Ryu0118](https://github.com/Ryu0118),
[https://github.com/pointfreeco/swift-composable-architecture/pull/2153](https://github.com/pointfreeco/swift-composable-architecture/pull/2153);
[@&#8203;Czajnikowski](https://github.com/Czajnikowski),
[https://github.com/pointfreeco/swift-composable-architecture/pull/2157](https://github.com/pointfreeco/swift-composable-architecture/pull/2157);
[@&#8203;kristofferjohansson](https://github.com/kristofferjohansson),
[https://github.com/pointfreeco/swift-composable-architecture/pull/2159](https://github.com/pointfreeco/swift-composable-architecture/pull/2159);
[@&#8203;jaesung-0o0](https://github.com/jaesung-0o0),
[https://github.com/pointfreeco/swift-composable-architecture/pull/2160](https://github.com/pointfreeco/swift-composable-architecture/pull/2160);
[https://github.com/pointfreeco/swift-composable-architecture/pull/2161](https://github.com/pointfreeco/swift-composable-architecture/pull/2161);
[@&#8203;takehilo](https://github.com/takehilo),
[https://github.com/pointfreeco/swift-composable-architecture/pull/2165](https://github.com/pointfreeco/swift-composable-architecture/pull/2165);
[@&#8203;nickkohrn](https://github.com/nickkohrn),
[https://github.com/pointfreeco/swift-composable-architecture/pull/2168](https://github.com/pointfreeco/swift-composable-architecture/pull/2168)
[https://github.com/pointfreeco/swift-composable-architecture/pull/2169](https://github.com/pointfreeco/swift-composable-architecture/pull/2169);
[@&#8203;d-date](https://github.com/d-date),
[https://github.com/pointfreeco/swift-composable-architecture/pull/2174](https://github.com/pointfreeco/swift-composable-architecture/pull/2174);
[@&#8203;oronbz](https://github.com/oronbz),
[https://github.com/pointfreeco/swift-composable-architecture/pull/2175](https://github.com/pointfreeco/swift-composable-architecture/pull/2175),
[https://github.com/pointfreeco/swift-composable-architecture/pull/2176](https://github.com/pointfreeco/swift-composable-architecture/pull/2176),
[https://github.com/pointfreeco/swift-composable-architecture/pull/2177](https://github.com/pointfreeco/swift-composable-architecture/pull/2177);
[@&#8203;devMinseok](https://github.com/devMinseok),
[https://github.com/pointfreeco/swift-composable-architecture/pull/2180](https://github.com/pointfreeco/swift-composable-architecture/pull/2180);
[@&#8203;ccxla](https://github.com/ccxla),
[https://github.com/pointfreeco/swift-composable-architecture/pull/2181](https://github.com/pointfreeco/swift-composable-architecture/pull/2181);
[@&#8203;filblue](https://github.com/filblue),
[https://github.com/pointfreeco/swift-composable-architecture/pull/2188](https://github.com/pointfreeco/swift-composable-architecture/pull/2188);
[@&#8203;thomastosoni](https://github.com/thomastosoni),
[https://github.com/pointfreeco/swift-composable-architecture/pull/2190](https://github.com/pointfreeco/swift-composable-architecture/pull/2190)).

#### New Contributors

- [@&#8203;Sajjon](https://github.com/Sajjon) made their first
contribution in
[https://github.com/pointfreeco/swift-composable-architecture/pull/2150](https://github.com/pointfreeco/swift-composable-architecture/pull/2150)
- [@&#8203;MarshalGeazipp](https://github.com/MarshalGeazipp) made
their first contribution in
[https://github.com/pointfreeco/swift-composable-architecture/pull/2154](https://github.com/pointfreeco/swift-composable-architecture/pull/2154)
- [@&#8203;takehilo](https://github.com/takehilo) made their first
contribution in
[https://github.com/pointfreeco/swift-composable-architecture/pull/2165](https://github.com/pointfreeco/swift-composable-architecture/pull/2165)
- [@&#8203;nickkohrn](https://github.com/nickkohrn) made their first
contribution in
[https://github.com/pointfreeco/swift-composable-architecture/pull/2168](https://github.com/pointfreeco/swift-composable-architecture/pull/2168)
- [@&#8203;akashsoni01](https://github.com/akashsoni01) made their
first contribution in
[https://github.com/pointfreeco/swift-composable-architecture/pull/2171](https://github.com/pointfreeco/swift-composable-architecture/pull/2171)
- [@&#8203;d-date](https://github.com/d-date) made their first
contribution in
[https://github.com/pointfreeco/swift-composable-architecture/pull/2174](https://github.com/pointfreeco/swift-composable-architecture/pull/2174)
- [@&#8203;oronbz](https://github.com/oronbz) made their first
contribution in
[https://github.com/pointfreeco/swift-composable-architecture/pull/2175](https://github.com/pointfreeco/swift-composable-architecture/pull/2175)
- [@&#8203;devMinseok](https://github.com/devMinseok) made their first
contribution in
[https://github.com/pointfreeco/swift-composable-architecture/pull/2180](https://github.com/pointfreeco/swift-composable-architecture/pull/2180)
- [@&#8203;ccxla](https://github.com/ccxla) made their first
contribution in
[https://github.com/pointfreeco/swift-composable-architecture/pull/2181](https://github.com/pointfreeco/swift-composable-architecture/pull/2181)
- [@&#8203;thomastosoni](https://github.com/thomastosoni) made their
first contribution in
[https://github.com/pointfreeco/swift-composable-architecture/pull/2190](https://github.com/pointfreeco/swift-composable-architecture/pull/2190)

**Full Changelog**:
pointfreeco/swift-composable-architecture@0.54.0...0.54.1

###
[`v0.54.0`](https://github.com/pointfreeco/swift-composable-architecture/releases/tag/0.54.0)

[Compare
Source](https://github.com/pointfreeco/swift-composable-architecture/compare/0.53.2...0.54.0)

#### What's Changed

- Added: All-new navigation tools for presenting child features
([https://github.com/pointfreeco/swift-composable-architecture/pull/1945](https://github.com/pointfreeco/swift-composable-architecture/pull/1945),
[pointfreeco/swift-composable-architecture#1944,
[pointfreeco/swift-composable-architecture#2048).

See the associated
[documentation](https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/navigation)
and
[tutorial](https://pointfreeco.github.io/swift-composable-architecture/main/tutorials/meetcomposablearchitecture/#navigation)
for how to incorporate these tools into your applications today!

- Added: `TestStore.assert`, for asserting state changes on
non-exhaustive stores at any time
([https://github.com/pointfreeco/swift-composable-architecture/pull/2123](https://github.com/pointfreeco/swift-composable-architecture/pull/2123)).

- Fixed: Ensure that a test store helper runs on the main actor
([https://github.com/pointfreeco/swift-composable-architecture/pull/2117](https://github.com/pointfreeco/swift-composable-architecture/pull/2117)).

- Added: Ukrainian translation of TCA's README (thanks
[@&#8203;barabashd](https://github.com/barabashd),
[https://github.com/pointfreeco/swift-composable-architecture/pull/2121](https://github.com/pointfreeco/swift-composable-architecture/pull/2121)).

- Infrastructure: DocC organization
([https://github.com/pointfreeco/swift-composable-architecture/pull/2118](https://github.com/pointfreeco/swift-composable-architecture/pull/2118)).

- Infrastructure: Ensure CI runs library tests in release
([https://github.com/pointfreeco/swift-composable-architecture/pull/2120](https://github.com/pointfreeco/swift-composable-architecture/pull/2120)).

- Fix assertion values by
[@&#8203;tomassliz](https://github.com/tomassliz) in
[https://github.com/pointfreeco/swift-composable-architecture/pull/2128](https://github.com/pointfreeco/swift-composable-architecture/pull/2128)

- Infrastructure: Documentation fixes (thanks
[@&#8203;tomassliz](https://github.com/tomassliz),
[https://github.com/pointfreeco/swift-composable-architecture/pull/2124](https://github.com/pointfreeco/swift-composable-architecture/pull/2124),
[https://github.com/pointfreeco/swift-composable-architecture/pull/2128](https://github.com/pointfreeco/swift-composable-architecture/pull/2128);
[@&#8203;jaesung-0o0](https://github.com/jaesung-0o0),
[https://github.com/pointfreeco/swift-composable-architecture/pull/2144](https://github.com/pointfreeco/swift-composable-architecture/pull/2144)).

#### New Contributors

- [@&#8203;tomassliz](https://github.com/tomassliz) made their first
contribution in
[https://github.com/pointfreeco/swift-composable-architecture/pull/2124](https://github.com/pointfreeco/swift-composable-architecture/pull/2124)
- [@&#8203;jaesung-0o0](https://github.com/jaesung-0o0) made their
first contribution in
[https://github.com/pointfreeco/swift-composable-architecture/pull/2144](https://github.com/pointfreeco/swift-composable-architecture/pull/2144)

**Full Changelog**:
pointfreeco/swift-composable-architecture@0.53.2...0.54.0

###
[`v0.53.2`](https://github.com/pointfreeco/swift-composable-architecture/releases/tag/0.53.2)

[Compare
Source](https://github.com/pointfreeco/swift-composable-architecture/compare/0.53.1...0.53.2)

#### What's Changed

- Make `Send` sendable
([https://github.com/pointfreeco/swift-composable-architecture/pull/2112](https://github.com/pointfreeco/swift-composable-architecture/pull/2112))
- When test exhaustivity is off, `receive` now waits for the expected
action rather than taking the first action (thanks
[@&#8203;alex-reilly-pronto](https://github.com/alex-reilly-pronto),
[https://github.com/pointfreeco/swift-composable-architecture/pull/2100](https://github.com/pointfreeco/swift-composable-architecture/pull/2100))
- Fix typo in the "Meet the Composable Architecture" (thanks
[@&#8203;redryerye](https://github.com/redryerye),
[https://github.com/pointfreeco/swift-composable-architecture/pull/2114](https://github.com/pointfreeco/swift-composable-architecture/pull/2114))
- Fix compile error in Xcode <14.3 (thanks
[@&#8203;hj56775](https://github.com/hj56775),
[https://github.com/pointfreeco/swift-composable-architecture/pull/2115](https://github.com/pointfreeco/swift-composable-architecture/pull/2115))

#### New Contributors

- [@&#8203;alex-reilly-pronto](https://github.com/alex-reilly-pronto)
made their first contribution in
[https://github.com/pointfreeco/swift-composable-architecture/pull/2100](https://github.com/pointfreeco/swift-composable-architecture/pull/2100)
- [@&#8203;redryerye](https://github.com/redryerye) made their first
contribution in
[https://github.com/pointfreeco/swift-composable-architecture/pull/2114](https://github.com/pointfreeco/swift-composable-architecture/pull/2114)
- [@&#8203;hj56775](https://github.com/hj56775) made their first
contribution in
[https://github.com/pointfreeco/swift-composable-architecture/pull/2115](https://github.com/pointfreeco/swift-composable-architecture/pull/2115)

**Full Changelog**:
pointfreeco/swift-composable-architecture@0.53.1...0.53.2

###
[`v0.53.1`](https://github.com/pointfreeco/swift-composable-architecture/releases/tag/0.53.1)

[Compare
Source](https://github.com/pointfreeco/swift-composable-architecture/compare/0.53.0...0.53.1)

#### What's Changed

- Fixed: A regression was introduced in 0.53.0 where `TestStore.init`'s
`prepareDependencies` was called twice. It will not be called just a
single time again
([https://github.com/pointfreeco/swift-composable-architecture/pull/2111](https://github.com/pointfreeco/swift-composable-architecture/pull/2111)).
- Infrastructure: Added a "Meet the Composable Architecture" tutorial
([https://github.com/pointfreeco/swift-composable-architecture/pull/2107](https://github.com/pointfreeco/swift-composable-architecture/pull/2107),
[https://github.com/pointfreeco/swift-composable-architecture/pull/2109](https://github.com/pointfreeco/swift-composable-architecture/pull/2109)).
- Infrastructure: Docs fixes (thanks
[@&#8203;Ryu0118](https://github.com/Ryu0118),
[https://github.com/pointfreeco/swift-composable-architecture/pull/2110](https://github.com/pointfreeco/swift-composable-architecture/pull/2110))

**Full Changelog**:
pointfreeco/swift-composable-architecture@0.53.0...0.53.1

###
[`v0.53.0`](https://github.com/pointfreeco/swift-composable-architecture/releases/tag/0.53.0)

[Compare
Source](https://github.com/pointfreeco/swift-composable-architecture/compare/0.52.0...0.53.0)

#### What's Changed

- Added: `Store.init` and `TestStore.init` now take reducer builders
([https://github.com/pointfreeco/swift-composable-architecture/pull/2087](https://github.com/pointfreeco/swift-composable-architecture/pull/2087)).
    ```swift
    // Before:
    Store(
      initialState: Feature.State(),
      reducer: Feature()
    )

    // After:
    Store(initialState: Feature.State()) {
      Feature()
    }
    ```

- Changed: `SwitchStore` has gotten some quality-of-life improvements
([https://github.com/pointfreeco/swift-composable-architecture/pull/2029](https://github.com/pointfreeco/swift-composable-architecture/pull/2029)).
- `SwitchStore.init` can now take the initial enum state so that it can
be switched over exhaustively. This initializer also relaxes certain
compile-time constraints previously requiring only `CaseLet` views and
an optional, trailing `Default` view.
- `CaseLet` can now omit the `state` parameter label, making it more
consistent with other APIs, like `Reducer.ifCaseLet`.
- The older `SwitchStore` and `CaseLet` initializers have been
soft-deprecated along with the `Default` view.

        ```swift
        // Before:
        SwitchStore(self.store) {
CaseLet(state: /App.State.loggedIn, action: App.Action.loggedIn) {
loggedInStore in
            LoggedInView(store: loggedInStore)
          }
CaseLet(state: /App.State.loggedOut, action: App.Action.loggedOut) {
loggedOutStore in
            LoggedOutView(store: loggedOutStore)
          }
        }

        // After:
        SwitchStore(self.store) {
switch $0 { // Can now switch over initial state for exhaustivity at
compile time
          case .loggedIn:
CaseLet(/App.State.loggedIn, action: App.Action.loggedIn) {
loggedInStore in
              LoggedInView(store: loggedInStore)
            }
.buttonStyle(.plain) // Can now render arbitrary views/modifiers in the
view builder
          case .loggedOut:
CaseLet(/App.State.loggedOut, action: App.Action.loggedOut) {
loggedOutStore in
              LoggedOutView(store: loggedOutStore)
            }
          }
        }
        ```

- Changed: `WithViewStore.debug` has been renamed to
`WithViewStore._printChanges` for consistency with
`Reducer._printChanges`
([https://github.com/pointfreeco/swift-composable-architecture/pull/2101](https://github.com/pointfreeco/swift-composable-architecture/pull/2101)).

- Fixed: `EffectTask.publisher` now properly escapes dependencies
accessed within it
([https://github.com/pointfreeco/swift-composable-architecture/pull/1988](https://github.com/pointfreeco/swift-composable-architecture/pull/1988)).

- Fixed: `Reducer._printChanges()` is no longer disabled in tests
([https://github.com/pointfreeco/swift-composable-architecture/pull/1995](https://github.com/pointfreeco/swift-composable-architecture/pull/1995)).
This allows it to be used for debugging purposes during test runs.

- Changed: The internal `Task.megaYield` tool, for more predictably
testing concurrent code, is now configurable via the
`TASK_MEGA_YIELD_COUNT` environment variable
([https://github.com/pointfreeco/swift-composable-architecture/pull/2064](https://github.com/pointfreeco/swift-composable-architecture/pull/2064)).

- Improved: The output format of `WithViewStore._printChanges()` has
been improved
([https://github.com/pointfreeco/swift-composable-architecture/pull/1973](https://github.com/pointfreeco/swift-composable-architecture/pull/1973)).

- Improved: Runtime warnings will now emit XCTest failures in test code
rather than in app code
([https://github.com/pointfreeco/swift-composable-architecture/pull/2059](https://github.com/pointfreeco/swift-composable-architecture/pull/2059)).

- Deprecated: Type-based cancel IDs have been deprecated
([https://github.com/pointfreeco/swift-composable-architecture/pull/2091](https://github.com/pointfreeco/swift-composable-architecture/pull/2091)).
Use hashable values, instead.

- Deprecated: The actionless overload of `Store.scope(state:)` has been
deprecated in favor of the `observe` parameter on view stores
([https://github.com/pointfreeco/swift-composable-architecture/pull/2097](https://github.com/pointfreeco/swift-composable-architecture/pull/2097)).

- Deprecated: `Effect.task` and `Effect.fireAndForget` have been
soft-deprecated in favor of `Effect.run`
([https://github.com/pointfreeco/swift-composable-architecture/pull/2099](https://github.com/pointfreeco/swift-composable-architecture/pull/2099)).

- Infrastructure: Added test coverage for child/parent effect
cancellation behavior
([https://github.com/pointfreeco/swift-composable-architecture/pull/1970](https://github.com/pointfreeco/swift-composable-architecture/pull/1970)).

- Infrastructure: Clean up effect cancellation logic
([https://github.com/pointfreeco/swift-composable-architecture/pull/1977](https://github.com/pointfreeco/swift-composable-architecture/pull/1977)).

-   Infrastructure: Miscellaneous documentation/formatting fixes:

Fixed missing `action` parameter in `ForEachStore` documentation (thanks
[@&#8203;m-housh](https://github.com/m-housh),
[https://github.com/pointfreeco/swift-composable-architecture/pull/1998](https://github.com/pointfreeco/swift-composable-architecture/pull/1998)).

Number fact tutorial fix (thanks
[@&#8203;siliconsorcery](https://github.com/siliconsorcery),
[https://github.com/pointfreeco/swift-composable-architecture/pull/1962](https://github.com/pointfreeco/swift-composable-architecture/pull/1962)).

`BindingAction` fix (thanks
[@&#8203;Ryu0118](https://github.com/Ryu0118),
[https://github.com/pointfreeco/swift-composable-architecture/pull/2019](https://github.com/pointfreeco/swift-composable-architecture/pull/2019)).

`withTaskCancellation(id:)` fix (thanks
[@&#8203;bjford](https://github.com/bjford),
[https://github.com/pointfreeco/swift-composable-architecture/pull/2049](https://github.com/pointfreeco/swift-composable-architecture/pull/2049)).

Formatting fix (thanks
[@&#8203;mooyoung2309](https://github.com/mooyoung2309),
[https://github.com/pointfreeco/swift-composable-architecture/pull/2056](https://github.com/pointfreeco/swift-composable-architecture/pull/2056)).

Update 'bindable state' to 'binding state' (thanks
[@&#8203;Jager-yoo](https://github.com/Jager-yoo),
[https://github.com/pointfreeco/swift-composable-architecture/pull/2054](https://github.com/pointfreeco/swift-composable-architecture/pull/2054)).

- Infrastructure: Added Russian README translation (thanks
[@&#8203;artyom-ivanov](https://github.com/artyom-ivanov),
[https://github.com/pointfreeco/swift-composable-architecture/pull/2014](https://github.com/pointfreeco/swift-composable-architecture/pull/2014)).

- Infrastructure: Added Polish README translation (thanks
[@&#8203;MarcelStarczyk](https://github.com/MarcelStarczyk),
[https://github.com/pointfreeco/swift-composable-architecture/pull/2040](https://github.com/pointfreeco/swift-composable-architecture/pull/2040)).

-   Infrastructure: Bump dependencies.

- Infrastructure: Bump Xcode demo project settings
([https://github.com/pointfreeco/swift-composable-architecture/pull/2042](https://github.com/pointfreeco/swift-composable-architecture/pull/2042)).

- Infrastructure: Clean up and test `TestStore.skipInFlightEffects`
([https://github.com/pointfreeco/swift-composable-architecture/pull/2057](https://github.com/pointfreeco/swift-composable-architecture/pull/2057)).

- Infrastructure: CI updates
([https://github.com/pointfreeco/swift-composable-architecture/pull/2060](https://github.com/pointfreeco/swift-composable-architecture/pull/2060)).

- Infrastructure: Document how exhaustive vs. non-exhaustive test stores
work
([https://github.com/pointfreeco/swift-composable-architecture/pull/2096](https://github.com/pointfreeco/swift-composable-architecture/pull/2096)).

#### New Contributors

- [@&#8203;m-housh](https://github.com/m-housh) made their first
contribution in
[https://github.com/pointfreeco/swift-composable-architecture/pull/1998](https://github.com/pointfreeco/swift-composable-architecture/pull/1998)
- [@&#8203;siliconsorcery](https://github.com/siliconsorcery) made
their first contribution in
[https://github.com/pointfreeco/swift-composable-architecture/pull/1962](https://github.com/pointfreeco/swift-composable-architecture/pull/1962)
- [@&#8203;artyom-ivanov](https://github.com/artyom-ivanov) made their
first contribution in
[https://github.com/pointfreeco/swift-composable-architecture/pull/2014](https://github.com/pointfreeco/swift-composable-architecture/pull/2014)
- [@&#8203;Ryu0118](https://github.com/Ryu0118) made their first
contribution in
[https://github.com/pointfreeco/swift-composable-architecture/pull/2019](https://github.com/pointfreeco/swift-composable-architecture/pull/2019)
- [@&#8203;MarcelStarczyk](https://github.com/MarcelStarczyk) made
their first contribution in
[https://github.com/pointfreeco/swift-composable-architecture/pull/2040](https://github.com/pointfreeco/swift-composable-architecture/pull/2040)
- [@&#8203;mooyoung2309](https://github.com/mooyoung2309) made their
first contribution in
[https://github.com/pointfreeco/swift-composable-architecture/pull/2056](https://github.com/pointfreeco/swift-composable-architecture/pull/2056)

**Full Changelog**:
pointfreeco/swift-composable-architecture@0.52.0...0.53.0

###
[`v0.52.0`](https://github.com/pointfreeco/swift-composable-architecture/releases/tag/0.52.0)

[Compare
Source](https://github.com/pointfreeco/swift-composable-architecture/compare/0.51.0...0.52.0)

#### What's Changed

- Added: Support for `XCTModify` and non-exhaustive testing
([https://github.com/pointfreeco/swift-composable-architecture/pull/1939](https://github.com/pointfreeco/swift-composable-architecture/pull/1939)).
- Added: Library reducer operators are now annotated with
`@warn_unqualified_access` to prevent accidental bugs
([https://github.com/pointfreeco/swift-composable-architecture/pull/1950](https://github.com/pointfreeco/swift-composable-architecture/pull/1950)).
- Added: `Effect.publisher` for bridging effects from Combine
([https://github.com/pointfreeco/swift-composable-architecture/pull/1958](https://github.com/pointfreeco/swift-composable-architecture/pull/1958)).
- Changed: `Effect<Action>.Send` has been renamed to `Send<Action>`
(thanks [@&#8203;tgrapperon](https://github.com/tgrapperon),
[https://github.com/pointfreeco/swift-composable-architecture/pull/1930](https://github.com/pointfreeco/swift-composable-architecture/pull/1930)).
- Changed: Dependencies have been bumped to their latest versions to
encourage adoption of bug fixes
([https://github.com/pointfreeco/swift-composable-architecture/pull/1964](https://github.com/pointfreeco/swift-composable-architecture/pull/1964)).
- Fixed: Dependencies are no longer recursively propagated over effects
([https://github.com/pointfreeco/swift-composable-architecture/pull/1954](https://github.com/pointfreeco/swift-composable-architecture/pull/1954)).
- Fixed: `TestStore.init` now calls `prepareDependencies` in a
`withDependencies` block
([https://github.com/pointfreeco/swift-composable-architecture/pull/1955](https://github.com/pointfreeco/swift-composable-architecture/pull/1955)).
- Infrastructure: Fix UI test for `ForEach` bindings
([https://github.com/pointfreeco/swift-composable-architecture/pull/1933](https://github.com/pointfreeco/swift-composable-architecture/pull/1933)).
- Infrastructure: Add missing documentation to `Store.init` (thanks
[@&#8203;kristofferjohansson](https://github.com/kristofferjohansson),
[https://github.com/pointfreeco/swift-composable-architecture/pull/1940](https://github.com/pointfreeco/swift-composable-architecture/pull/1940)).
- Infrastructure: DocC fixes
([https://github.com/pointfreeco/swift-composable-architecture/pull/1942](https://github.com/pointfreeco/swift-composable-architecture/pull/1942),
[https://github.com/pointfreeco/swift-composable-architecture/pull/1956](https://github.com/pointfreeco/swift-composable-architecture/pull/1956)).
- Infrastructure: Update latest version documentation link in README
(thanks [@&#8203;yimajo](https://github.com/yimajo),
[https://github.com/pointfreeco/swift-composable-architecture/pull/1943](https://github.com/pointfreeco/swift-composable-architecture/pull/1943))
- Infrastructure: Fix `.forEach()` documentation (thanks
[@&#8203;finestructure](https://github.com/finestructure),
[https://github.com/pointfreeco/swift-composable-architecture/pull/1957](https://github.com/pointfreeco/swift-composable-architecture/pull/1957)).
- Infrastructure: Documentation grammar fixes (thanks
[@&#8203;bjford](https://github.com/bjford),
[https://github.com/pointfreeco/swift-composable-architecture/pull/1963](https://github.com/pointfreeco/swift-composable-architecture/pull/1963))

#### New Contributors

-
[@&#8203;kristofferjohansson](https://github.com/kristofferjohansson)
made their first contribution in
[https://github.com/pointfreeco/swift-composable-architecture/pull/1940](https://github.com/pointfreeco/swift-composable-architecture/pull/1940)

**Full Changelog**:
pointfreeco/swift-composable-architecture@0.51.0...0.52.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/cgrindel/rules_swift_package_manager).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS4xNDQuMiIsInVwZGF0ZWRJblZlciI6IjM1LjE0NC4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants