From d3f20a7a24cb1d811ce0eee697f8a7e977b5a79b Mon Sep 17 00:00:00 2001 From: Takeshi Shimada Date: Mon, 27 Oct 2025 21:40:01 +0900 Subject: [PATCH] docs: Improve README based on CoreConcepts documentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Enhance the "Result-Returning Actions" section in both English and Japanese READMEs to provide clearer explanations: **Changes:** - Add explicit mention that ActionResult type can be freely defined - Provide context for the example ("child view returns selection result") - Restructure benefits as "This implementation provides:" with detailed points - Clarify how ChildFeature, ParentView, and callbacks work together - Emphasize dependency tracking within the view tree **Impact:** - Better understanding of the result-returning pattern - Clearer explanation of parent-child communication - More explicit benefits and use cases These improvements align the README with the detailed explanations found in CoreConcepts.md documentation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- README.md | 11 ++++++++--- README_jp.md | 11 ++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index ed8a12b..afcd5e4 100644 --- a/README.md +++ b/README.md @@ -98,7 +98,9 @@ struct CounterView: View { ### Result-Returning Actions -Actions can return results through `ActionTask`. This enables parent-child result passing and allows navigation with a navigator from @Environment, keeping everything within the view tree. +Actions can return results through `ActionTask`. The result type (`ActionResult`) can be freely defined for each Feature. + +In this example, a child view returns a selection result to the parent, which handles navigation: ```swift struct ChildSelectFeature: Feature { @@ -158,8 +160,11 @@ struct ParentView: View { } ``` -- Parent-child result passing stays within the view tree -- Navigation possible with navigator from @Environment +This implementation provides: +- `ChildFeature` returns selection results to the parent via `ActionResult` +- `ParentView` receives results through the `onSelect` callback +- Parent controls side effects like navigation +- Everything stays within the view tree, making dependencies easy to track ### @Observable Support diff --git a/README_jp.md b/README_jp.md index ce78a86..d82b05e 100644 --- a/README_jp.md +++ b/README_jp.md @@ -96,7 +96,9 @@ struct CounterView: View { ### 結果を返すアクション -アクションは`ActionTask`を通じて結果を返せます。これにより、親子間での結果の受け渡しが可能になります。また、結果を受け取った後に@Environmentから取得したnavigatorで画面遷移することで、すべてがビューツリー内で完結します。 +アクションは`ActionTask`を通じて結果を返せます。結果の型(`ActionResult`)は各Featureで自由に定義できます。 + +この例では、子ビューが選択結果を親に返し、親が画面遷移を処理します: ```swift struct ChildSelectFeature: Feature { @@ -156,8 +158,11 @@ struct ParentView: View { } ``` -- 親子間での結果の受け渡しがビューツリー内で完結 -- @Environmentから取得したnavigatorで画面遷移が可能 +この実装により: +- `ChildFeature`が`ActionResult`を通じて選択結果を親に返す +- `ParentView`が`onSelect`コールバックで結果を受け取る +- 親が画面遷移などの副作用を制御 +- すべてがビューツリー内で完結し、依存関係が追跡しやすい ### @Observable準拠