Skip to content

Add comprehensive Focus management reference#54

Merged
AvdLee merged 3 commits into
mainfrom
add-focus-patterns
Apr 3, 2026
Merged

Add comprehensive Focus management reference#54
AvdLee merged 3 commits into
mainfrom
add-focus-patterns

Conversation

@AvdLee
Copy link
Copy Markdown
Owner

@AvdLee AvdLee commented Apr 2, 2026

Summary

  • Add references/focus-patterns.md covering the full SwiftUI Focus API surface: @FocusState, .focusable(), FocusInteractions, @FocusedValue/@FocusedBinding/@FocusedObject, .defaultFocus, focus scope/sections, focus effects, search focus, and common pitfalls
  • Update SKILL.md with Topic Router entry, References entry, and two Correctness Checklist items for focus
  • Replace inline @FocusState section in state-management.md with a cross-reference to the new dedicated file

Fixes #48

Motivation

Issue #48 requested best practices around Focus, @FocusState, and related APIs. The existing skill had only a minimal 35-line @FocusState section in state-management.md covering basic Bool/enum usage. Apple's Focus API surface includes 20+ APIs across 8 categories, most of which were undocumented in the skill.

The new reference file covers the specific gotcha from the issue (redundant @FocusState writes in tap gesture handlers on .focusable() views causing focus to briefly appear then disappear) as a documented common pitfall.

Test plan

  • Verify focus-patterns.md renders correctly and all code examples compile
  • Verify cross-reference from state-management.md points to the correct file
  • Verify Topic Router and References in SKILL.md include the new entry
  • Verify Correctness Checklist items are present

AvdLee and others added 2 commits April 2, 2026 15:55
Add references/focus-patterns.md covering FocusState, focusable views,
FocusedValue/FocusedBinding/FocusedObject, default focus, focus scope
and sections, focus effects, search focus, and common pitfalls.

Update SKILL.md with Topic Router entry, References entry, and two
Correctness Checklist items for focus. Replace inline @focusstate
section in state-management.md with cross-reference to the new file.

Fixes #48
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new SwiftUI focus-management reference to the swiftui-expert-skill docs, and wires it into the skill’s router/references so agents can discover and use it while keeping existing docs lean.

Changes:

  • Add references/focus-patterns.md covering SwiftUI Focus APIs and common pitfalls.
  • Update SKILL.md to route “Focus management” tasks to the new reference and add focus-related checklist items.
  • Replace the inline @FocusState section in references/state-management.md with a cross-reference to the new focus reference (and update README structure list).

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
swiftui-expert-skill/SKILL.md Adds Focus management to the Topic Router, references list, and correctness checklist.
swiftui-expert-skill/references/state-management.md Replaces the inline @FocusState guidance with a pointer to the new focus reference.
swiftui-expert-skill/references/focus-patterns.md New comprehensive Focus API reference and pitfalls section.
README.md Adds the new reference file to the documented skill structure list.

Comment thread swiftui-expert-skill/references/focus-patterns.md Outdated
Focused values are typically optional but can use non-optional entries
with a sensible default value.
@AvdLee AvdLee merged commit 15afee6 into main Apr 3, 2026
1 check passed
@AvdLee AvdLee deleted the add-focus-patterns branch April 3, 2026 11:34
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.

Feature Request: Focus

2 participants