focus-engine

Centralize focus management across SwiftUI and UIKit with @FocusState and defaultFocus.

Updated Jun 5, 2026
One-click install
npx skills add https://github.com/harshav167/build-ios-apps --skill focus-engine-harshav167
Or copy as Structured Prompt for Agentâ–¼
Please help me install this Agent Skill.
Skill: focus-engine
Source: https://github.com/harshav167/build-ios-apps/tree/main/skills/focus-engine
Command: npx skills add https://github.com/harshav167/build-ios-apps --skill focus-engine-harshav167

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Focus management across SwiftUI and UIKit can be verbose and error-prone, leading to inconsistent navigation experiences across platforms.

Core Features & Use Cases

  • Centralized focus control using @FocusState, defaultFocus, and focused values to provide deterministic keyboard, remote, and controller navigation.
  • Support for multi-platform navigation (iOS, macOS, tvOS, visionOS) with clear separation between visionOS hover and focus, and dedicated accessibility routing to ios-accessibility.
  • Includes utilities for focus restoration, focus sections, and UIKit focus guides to build robust, accessible interfaces in complex layouts.

Quick Start

Enable the Focus Engine in your app by annotating your focusable views with @FocusState and applying .defaultFocus and focused values for predictable navigation.

Frequently Asked Questions about focus-engine

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I manage focus state deterministically across SwiftUI and UIKit in a multi-platform app?â–¼

Deterministic focus state across SwiftUI and UIKit is managed by centralizing control with @FocusState, defaultFocus, and focused values to ensure predictable keyboard, remote, and controller navigation across iOS, macOS, tvOS, and visionOS.

What's the best way to handle focus restoration and sectioning in complex tvOS layouts?â–¼

Focus restoration and sectioning in complex tvOS layouts are handled using dedicated utilities and focus sections that build robust, accessible interfaces, ensuring navigation remains predictable when users move between different areas of the screen.

Can I use UIKit focus guides alongside SwiftUI focused values for gamepad navigation?â–¼

Yes, UIKit focus guides can be used alongside SwiftUI focused values to bridge navigation gaps in complex layouts, ensuring deterministic gamepad and remote control focus movement across both UI frameworks within the same application.

Does visionOS hover effect require the same focus management as keyboard navigation?â–¼

No, visionOS hover effects are explicitly separated from focus management. Hover interactions are treated distinctly from keyboard or remote focus routing, while accessibility concerns are routed separately to dedicated accessibility handling.

Why does initial focus default to the wrong field when navigating between scenes in SwiftUI?â–¼

Initial focus defaults incorrectly when explicit focus assignment is missing. Applying defaultFocus and scene-level focused values ensures the correct focusable view receives focus deterministically when a new scene or view hierarchy appears.