focus-engine — Claude Code skill for SwiftUI and UIKit focus
An AI-coding skill for focus handling in SwiftUI and UIKit: keyboard and directional movement, scene values, restoration after presentation changes. Useful when Siri Remote or Tab navigation lands on the wrong control.
npx skills add dpearson2699/swift-ios-skills --skill focus-engine -a claude-codeWhat focus-engine does
The skill covers focus in SwiftUI and UIKit apps built for iOS 26+, iPadOS, macOS, tvOS and visionOS with connected input. It walks through @FocusState, .defaultFocus, focused values and scene values, plus .focusable(_:interactions:). Each topic comes with code and a list of common mistakes, and there is a review checklist at the end.
Dedicated parts deal with getting focus back after a sheet, popover or overlay closes, and with UIFocusGuide in UIKit when the layout has gaps and arrows travel off course. tvOS gets geometric focus and Siri Remote navigation, watchOS gets Digital Crown input, macOS gets the key view loop and Full Keyboard Access. Note that focusSection() targets macOS 13+ and tvOS 15+, so older deployment targets matter here.
The boundaries are spelled out. On visionOS, gaze and pointer targeting count as input affordances rather than focus. VoiceOver, Switch Control and accessibility element ordering belong to the ios-accessibility skill. Without that split a prompt easily sends the agent down the wrong path, so decide first which kind of focus you actually need.
What it helps with
- move focus to the next field after submit
- fix arrow-key traversal on tvOS
- bring focus back to a trigger button after a sheet closes
- route focus across empty space in a UIKit layout
- debug a focus chain with
UIFocusDebugger
Example prompts for the agent
- After the form submits, focus should jump from email to password — build it with
@FocusState. - On tvOS the down arrow skips the middle column; wrap each group in
focusSection(). - Focus disappears when the sheet closes — put it back on the button that opened it.
How to install focus-engine
1Skills CLI (Vercel)
npx skills add dpearson2699/swift-ios-skills --skill focus-engine -a claude-code2Manually: put the files in place
~/.claude/skills/focus-engine/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/focus-engine/
1Skills CLI (Vercel)
npx skills add dpearson2699/swift-ios-skills --skill focus-engine -a codex2Manually: put the files in place
.agents/skills/focus-engine/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add dpearson2699/swift-ios-skills --skill focus-engine -a cursor2Manually: put the files in place
.cursor/skills/focus-engine/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install dpearson2699/swift-ios-skills focus-engine2Manually: put the files in place
.github/skills/focus-engine/SKILL.md1Skills CLI (Vercel)
npx skills add dpearson2699/swift-ios-skills --skill focus-engine -a gemini-cli2Platform CLI
gemini skills install https://github.com/dpearson2699/swift-ios-skills --path skills/focus-engineManually: put the files in place
.devin/skills/focus-engine/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add dpearson2699/swift-ios-skills --skill focus-engine -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about focus-engine
How do I install focus-engine in Claude Code?
Run npx skills add dpearson2699/swift-ios-skills --skill focus-engine -a claude-code. The skill file lands at ~/.claude/skills/focus-engine/SKILL.md.
What does focus-engine do?
It guides the agent through focus on Apple platforms: @FocusState, .defaultFocus, focused values, focus sections, restoration after presentations, UIFocusGuide in UIKit and UIFocusDebugger for debugging.
How is it different from the accessibility skill?
focus-engine handles keyboard, remote and game-controller focus along with scene-level focus. VoiceOver, Switch Control and accessibility ordering are left to ios-accessibility.