Skip to content

docs: Improve core documentation#13

Merged
takeshishimada merged 6 commits intomainfrom
docs/improve-core-documentation
Oct 30, 2025
Merged

docs: Improve core documentation#13
takeshishimada merged 6 commits intomainfrom
docs/improve-core-documentation

Conversation

@takeshishimada
Copy link
Copy Markdown
Contributor

Summary

Comprehensive documentation improvements for core Flow types (Feature, ActionHandler) based on code review feedback. All changes are documentation-only with one refactoring to improve API discoverability.

Changes

1. Add @observable requirement warning to Feature protocol

  • File: Feature.swift
  • Change: Add explicit warning that State must use @Observable macro
  • Rationale: Type system cannot enforce this requirement, but forgetting it causes SwiftUI views to not update automatically

2. Clarify state parameter in .run closure examples

  • File: Feature.swift
  • Change: Add inline comments and documentation note explaining state parameter semantics
  • Rationale: Both outer and inner state parameters refer to same instance (reference type), which may be confusing without clarification

3. Re-export ActionExecution typealias in ActionHandler

  • File: ActionHandler.swift, ActionProcessor.swift
  • Change: Move ActionExecution typealias definition to ActionHandler.swift with comprehensive documentation
  • Rationale: Improves discoverability - users working with ActionHandler now have direct access to the type definition

4. Document Feature.handle() call semantics

  • File: Feature.swift
  • Change: Add note explaining handle() is called once during Store initialization
  • Rationale: Clarifies lifecycle management - prevents confusion about when/how often to call handle()

5. Fill ActionHandler documentation gaps

  • File: ActionHandler.swift
  • Changes:
    • onError: Clarify multiple calls replace previous handler + add example
    • transform: Add detailed logging example showing practical use case
    • use: Document middleware execution order (registration order) + add example
  • Rationale: These methods had minimal documentation, making them hard to use correctly

Testing

  • ✅ All 299 tests pass
  • ✅ SwiftLint clean (no violations)

Impact

  • Breaking Changes: None
  • API Changes: ActionExecution now publicly exported from ActionHandler.swift (improvement)
  • Documentation: Significantly improved clarity for core types

🤖 Generated with Claude Code

@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Oct 30, 2025
takeshishimada and others added 5 commits October 31, 2025 00:20
Add explicit warning to State associatedtype documentation that
@observable macro is required but cannot be enforced by type system.
Missing this macro causes SwiftUI views to not update automatically.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Add inline comments and documentation note explaining that the state
parameter in .run closures refers to the same instance as the outer
state parameter (reference type semantics). This clarifies that
mutations inside .run are immediately visible to outer scope.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Add ActionExecution typealias to ActionHandler.swift for better
discoverability. Previously only defined in ActionProcessor.swift,
users now have direct access to the type definition when working
with ActionHandler. Includes comprehensive documentation and usage
examples.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Add documentation clarifying that handle() is called once during
Store initialization and the returned ActionHandler is reused for
all subsequent actions. Prevents confusion about lifecycle management.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Add comprehensive documentation for method chaining methods:
- onError: Clarify that multiple calls replace previous handler
- transform: Add detailed logging example showing use case
- use: Document middleware execution order (registration order)

Includes practical examples for each method to guide users.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@takeshishimada takeshishimada force-pushed the docs/improve-core-documentation branch from 2bedcb2 to 92d7c61 Compare October 30, 2025 15:21
@takeshishimada takeshishimada self-assigned this Oct 30, 2025
@takeshishimada takeshishimada merged commit 6ea1de0 into main Oct 30, 2025
7 checks passed
@takeshishimada takeshishimada deleted the docs/improve-core-documentation branch October 31, 2025 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant