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

Basics of composition in the "essentials" tutorial #2659

Merged
merged 8 commits into from
Dec 19, 2023
Merged

Conversation

mbrandonw
Copy link
Member

Realized that there was an opportunity to do a basic intro to composition during the essentials tutorial. And then the navigation tutorial provides a more advanced look into composition.

@@ -508,6 +508,28 @@ case .startButtonTapped:
This greatly reduces the bandwidth of actions being sent into the system so that you are not
incurring unnecessary costs for sending actions.

Another example that comes up often is sliders. If done in the most direct way, by deriving a
Copy link
Member Author

Choose a reason for hiding this comment

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

Unrelated to the core of this PR, but this came up in slack today and thought it would be good to add. I think the example before this of limiting actions in effects is a little complex, and so a simpler example of a Slider would be nice.

@@ -114,7 +114,7 @@
``ComposableArchitecture/PresentationState`` that allows you to modify the data in the case
of any enum.

> Tip: See ``ComposableArchitecture/PresentationState/subscript(case:)-2sweb`` for
> Tip: See ``ComposableArchitecture/PresentationState/subscript(case:)-7uqte`` for
Copy link
Member Author

Choose a reason for hiding this comment

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

unrelated to this PR, but this was pointing to the deprecated subscript.

@@ -92,7 +92,26 @@ public struct PresentationState<State> {

/// Accesses the value associated with the given case for reading and writing.
///
/// > Note: Accessing the wrong case will result in a runtime warning.
/// If you using the techniques of tree-based navigation (see <doc:TreeBasedNavigation>), then
Copy link
Member Author

Choose a reason for hiding this comment

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

Just beefing up these docs a bit.

@@ -55,7 +55,26 @@ public struct StackState<Element> {

/// Accesses the value associated with the given id and case for reading and writing.
///
/// > Note: Accessing the wrong case will result in a runtime warning.
/// When using stack-based navigation (see <doc:StackBasedNavigation>) you will typically have a
Copy link
Member Author

Choose a reason for hiding this comment

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

Same here

@@ -102,11 +106,11 @@ import SwiftUI
///
/// If your view does not need access to any state in the store and only needs to be able to send
/// actions, then you should consider not using ``WithViewStore`` at all. Instead, you can send
/// actions to a ``Store`` in a lightweight way like so:
/// actions directly to a ``Store`` like so:
Copy link
Member Author

Choose a reason for hiding this comment

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

Noticed that there's a more modern way of handling this.

Copy link
Member

@stephencelis stephencelis left a comment

Choose a reason for hiding this comment

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

Nice! I think it'd be good to flesh out some parent domain logic eventually, but we can evolve things more over time.

@mbrandonw mbrandonw merged commit b091bd7 into main Dec 19, 2023
3 of 5 checks passed
@mbrandonw mbrandonw deleted the composing-tutorial branch December 19, 2023 22:48
cgrindel-self-hosted-renovate bot referenced this pull request in cgrindel/rules_swift_package_manager Dec 21, 2023
…ure to from: "1.5.6" (#821)

This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
|
[pointfreeco/swift-composable-architecture](https://togithub.com/pointfreeco/swift-composable-architecture)
| patch | `from: "1.5.5"` -> `from: "1.5.6"` |

---

### Release Notes

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

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

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

#### What's Changed

> \[!IMPORTANT]
> While this release contains no additions or breaking changes to the
Composable Architecture's APIs, the `Store.scope` operation has been
significantly refactored for performance. While we have vetted these
changes in our own test suites and applications, and have worked with
members of the community to test these changes before this release,
please thoroughly test the view layer of your applications after
upgrading to this version, and before releasing your application to
production.
>
> See
[#&#8203;2664](https://togithub.com/pointfreeco/swift-composable-architecture/issues/2664)
for more details on the change.

- Performance: Overhaul store scope communication
([https://github.com/pointfreeco/swift-composable-architecture/pull/2664](https://togithub.com/pointfreeco/swift-composable-architecture/pull/2664)).
- Infrastructure: Update sample code to use the `@DependencyClient`
macro
([https://github.com/pointfreeco/swift-composable-architecture/pull/2653](https://togithub.com/pointfreeco/swift-composable-architecture/pull/2653)).
- Infrastructure: Update migration guide with more information about
applying `@CasePathable` to enums
([https://github.com/pointfreeco/swift-composable-architecture/pull/2672](https://togithub.com/pointfreeco/swift-composable-architecture/pull/2672)).
- Infrastructure: Add basics of composition to the "essentials" tutorial
([https://github.com/pointfreeco/swift-composable-architecture/pull/2659](https://togithub.com/pointfreeco/swift-composable-architecture/pull/2659)).

**Full Changelog**:
pointfreeco/swift-composable-architecture@1.5.5...1.5.6

</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.

2 participants