Skip to content
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

Clean up and modernize docs/examples #2480

Merged
merged 2 commits into from Sep 28, 2023
Merged

Clean up and modernize docs/examples #2480

merged 2 commits into from Sep 28, 2023

Conversation

stephencelis
Copy link
Member

This PR just goes through our docs and examples and modernizes a few things, mainly:

  • Updating action: MyFeature.Action.case to action: { .case($0) }, which is often shorter and more symmetrical with state: \.value.
  • Removing unnecessary <State, Action> generic parameter list from Reduce.
  • General SwiftUI API modernization.

This PR just goes through our docs and examples and modernizes a few
things, mainly:

  * Updating `action: MyFeature.Action.case` to `action: { .case($0) }`,
    which is often shorter and more symmetrical with `state: \.value`.
  * Removing unnecessary `<State, Action>` generic parameter list from
    `Reduce`.
  * General SwiftUI API modernization.
@@ -25,7 +25,7 @@ struct AppFeature: Reducer {
Scope(state: \.standupsList, action: /Action.standupsList) {
StandupsList()
}
Reduce<State, Action> { state, action in
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be removed if it means that Xcode now has a very hard time auto-completing the action enums? Looks like it's still a problem in Xcode 15 and Swift 5.9. I don't have a problem with it; just keeping in mind in case this was forgotten :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@acosmicflamingo I believe inference should have been fixed for 5.8.1+, and definitely fixed in Swift 5.9. Do you have an example that doesn't compile that we can send along to Apple?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right; my apologies. I am unable to reproduce with the reducers within your codebase. I am only able to reproduce in my reducers that have tons of cases (since I'm utilizing ViewAction, DelegateAction, InternalAction enums) but when I clean up a lot of it; the auto-complete is correct.

Copy link
Contributor

@acosmicflamingo acosmicflamingo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a note about removing generics from Reducer and its impact on auto-completion, in case this is a priority for you guys.

@@ -135,7 +135,7 @@ struct AnimationsView: View {
"Big mode",
isOn:
viewStore
.binding(get: \.isCircleScaled, send: Animations.Action.circleScaleToggleChanged)
.binding(get: \.isCircleScaled, send: { .circleScaleToggleChanged($0) })
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question
Why do you use binding(get:send:) instead of using BindingState?

viewStore.$isCircleScaled

Is this to avoid changing the logic since you've already provided the episode video?
OR is there any case where it prefers to use binding(get:send:)?

@stephencelis stephencelis merged commit c0d8fba into main Sep 28, 2023
5 checks passed
@stephencelis stephencelis deleted the cleanup branch September 28, 2023 13:58
cgrindel-self-hosted-renovate bot added a commit to cgrindel/rules_swift_package_manager that referenced this pull request Oct 25, 2023
…ure to from: "1.3.0" (#689)

This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
|
[pointfreeco/swift-composable-architecture](https://togithub.com/pointfreeco/swift-composable-architecture)
| minor | `from: "1.2.0"` -> `from: "1.3.0"` |

---

### Release Notes

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

###
[`v1.3.0`](https://togithub.com/pointfreeco/swift-composable-architecture/releases/tag/1.3.0)

[Compare
Source](https://togithub.com/pointfreeco/swift-composable-architecture/compare/1.2.0...1.3.0)

#### What's Changed

- Added: `dismiss(transaction:)` dependency (thanks
[@&#8203;tomokisun](https://togithub.com/tomokisun),
[pointfreeco/swift-composable-architecture#2433).
- Fixed: `Reducer.ifLet` child effects are now properly cancelled when
reset by a parent
([pointfreeco/swift-composable-architecture#2402).
- Fixed: Added missing `file` and `line` parameters to `dismiss`
dependency (thanks [@&#8203;heiberg](https://togithub.com/heiberg),
[pointfreeco/swift-composable-architecture#2440).
- Fixed: Only dismiss alert/dialog state when receiving a
domain-specific action
([pointfreeco/swift-composable-architecture#2468).
- Fixed: Serialize `Reducer._printChanges()`
([pointfreeco/swift-composable-architecture#2519).
- Infrastructure: README, tutorial, and other assorted fixes (thanks
[@&#8203;zooxop](https://togithub.com/zooxop),
[pointfreeco/swift-composable-architecture#2405;
thanks [@&#8203;filblue](https://togithub.com/filblue),
[pointfreeco/swift-composable-architecture#2418,
[pointfreeco/swift-composable-architecture#2467,
[pointfreeco/swift-composable-architecture#2486;
thanks [@&#8203;yimajo](https://togithub.com/yimajo),
[pointfreeco/swift-composable-architecture#2425,
[pointfreeco/swift-composable-architecture#2426;
thanks [@&#8203;denil-ct](https://togithub.com/denil-ct),
[pointfreeco/swift-composable-architecture#2427;
thanks [@&#8203;mornin-ystIUBqR](https://togithub.com/mornin-ystIUBqR),
[pointfreeco/swift-composable-architecture#2446;
thanks [@&#8203;jkimdev](https://togithub.com/jkimdev),
[pointfreeco/swift-composable-architecture#2454;
thanks [@&#8203;Jager-yoo](https://togithub.com/Jager-yoo),
[pointfreeco/swift-composable-architecture#2442;
[pointfreeco/swift-composable-architecture#2472;
thanks [@&#8203;vasiliyzaycev](https://togithub.com/vasiliyzaycev),
[pointfreeco/swift-composable-architecture#2474,
[pointfreeco/swift-composable-architecture#2475;
thanks [@&#8203;jtouzy](https://togithub.com/jtouzy) in
[pointfreeco/swift-composable-architecture#2477;
thanks [@&#8203;jaesung-0o0](https://togithub.com/jaesung-0o0),
[pointfreeco/swift-composable-architecture#2484,
[pointfreeco/swift-composable-architecture#2499;
thanks [@&#8203;ictechgy](https://togithub.com/ictechgy),
[pointfreeco/swift-composable-architecture#2481;
thanks [@&#8203;Ryu0118](https://togithub.com/Ryu0118),
[pointfreeco/swift-composable-architecture#2482;
[pointfreeco/swift-composable-architecture#2480;
thanks [@&#8203;KyleLeneau](https://togithub.com/KyleLeneau),
[pointfreeco/swift-composable-architecture#2493;
thanks [@&#8203;kalupas226](https://togithub.com/kalupas226),
[pointfreeco/swift-composable-architecture#2498;
thanks [@&#8203;kodok1988](https://togithub.com/kodok1988),
[pointfreeco/swift-composable-architecture#2511).
- Infrastructure: Rename Standups sample project to SyncUps
([pointfreeco/swift-composable-architecture#2524);
remove meeting feature reducer
([pointfreeco/swift-composable-architecture#2410);
fixed `.minutes` duration (thanks
[@&#8203;filblue](https://togithub.com/filblue),
[pointfreeco/swift-composable-architecture#2437).
- Infrastructure: Bump `actions/checkout` version to `v4` (thanks
[@&#8203;Ryu0118](https://togithub.com/Ryu0118),
[pointfreeco/swift-composable-architecture#2479).
- Infrastructure: Clean up `StoreTask.cancel` implementation (thanks
[@&#8203;Ryu0118](https://togithub.com/Ryu0118),
[pointfreeco/swift-composable-architecture#2496).
- Infrastructure: Revamp integration tests
([pointfreeco/swift-composable-architecture#2503,
[pointfreeco/swift-composable-architecture#2515).
- Infrastructure: Simplify SwiftUI case studies
([pointfreeco/swift-composable-architecture#2526).
- Infrastructure: Fixed search example debounce duration (thanks
[@&#8203;wtsnz](https://togithub.com/wtsnz),
[pointfreeco/swift-composable-architecture#2525).

#### New Contributors

- [@&#8203;zooxop](https://togithub.com/zooxop) made their first
contribution in
[pointfreeco/swift-composable-architecture#2405
- [@&#8203;denil-ct](https://togithub.com/denil-ct) made their first
contribution in
[pointfreeco/swift-composable-architecture#2427
- [@&#8203;tomokisun](https://togithub.com/tomokisun) made their first
contribution in
[pointfreeco/swift-composable-architecture#2433
- [@&#8203;mornin-ystIUBqR](https://togithub.com/mornin-ystIUBqR) made
their first contribution in
[pointfreeco/swift-composable-architecture#2446
- [@&#8203;jkimdev](https://togithub.com/jkimdev) made their first
contribution in
[pointfreeco/swift-composable-architecture#2454
- [@&#8203;vasiliyzaycev](https://togithub.com/vasiliyzaycev) made their
first contribution in
[pointfreeco/swift-composable-architecture#2474
- [@&#8203;jtouzy](https://togithub.com/jtouzy) made their first
contribution in
[pointfreeco/swift-composable-architecture#2477
- [@&#8203;ictechgy](https://togithub.com/ictechgy) made their first
contribution in
[pointfreeco/swift-composable-architecture#2481
- [@&#8203;KyleLeneau](https://togithub.com/KyleLeneau) made their first
contribution in
[pointfreeco/swift-composable-architecture#2493
- [@&#8203;kodok1988](https://togithub.com/kodok1988) made their first
contribution in
[pointfreeco/swift-composable-architecture#2511
- [@&#8203;wtsnz](https://togithub.com/wtsnz) made their first
contribution in
[pointfreeco/swift-composable-architecture#2525

**Full Changelog**:
pointfreeco/swift-composable-architecture@1.2.0...1.3.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.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config help](https://togithub.com/renovatebot/renovate/discussions) if
that's undesired.

---

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

---

This PR has been generated by [Renovate
Bot](https://togithub.com/renovatebot/renovate).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi4xMDAuMCIsInVwZGF0ZWRJblZlciI6IjM2LjEwMC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

Co-authored-by: Self-hosted Renovate Bot <361546+cgrindel-self-hosted-renovate[bot]@users.noreply.github.enterprise.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.

None yet

4 participants