Add comprehensive Focus management reference#54
Merged
Conversation
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
Contributor
There was a problem hiding this comment.
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.mdcovering SwiftUI Focus APIs and common pitfalls. - Update
SKILL.mdto route “Focus management” tasks to the new reference and add focus-related checklist items. - Replace the inline
@FocusStatesection inreferences/state-management.mdwith 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. |
Focused values are typically optional but can use non-optional entries with a sensible default value.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
references/focus-patterns.mdcovering the full SwiftUI Focus API surface:@FocusState,.focusable(),FocusInteractions,@FocusedValue/@FocusedBinding/@FocusedObject,.defaultFocus, focus scope/sections, focus effects, search focus, and common pitfallsSKILL.mdwith Topic Router entry, References entry, and two Correctness Checklist items for focus@FocusStatesection instate-management.mdwith a cross-reference to the new dedicated fileFixes #48
Motivation
Issue #48 requested best practices around Focus,
@FocusState, and related APIs. The existing skill had only a minimal 35-line@FocusStatesection instate-management.mdcovering 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
@FocusStatewrites in tap gesture handlers on.focusable()views causing focus to briefly appear then disappear) as a documented common pitfall.Test plan
focus-patterns.mdrenders correctly and all code examples compilestate-management.mdpoints to the correct fileSKILL.mdinclude the new entry