What problem does it solve?
Focus breaks user flow on multi-platform Apple apps when keyboard, directional navigation, and focus restoration are inconsistent, leaving users unsure where input will land next.
Core Features & Use Cases
- SwiftUI focus management with
@FocusState, .focused, .defaultFocus, and focusable custom controls via .focusable(interactions:).
- Scene-aware focused state using focused values like
focusedSceneValue for menus/commands/toolbars that must act on the currently focused content.
- Platform-specific focus navigation including macOS/tvOS
focusSection() guidance for uneven layouts and UIKit routing with UIFocusGuide.
- Focus restoration after transient UI so dismissing sheets/popovers overlays returns focus to a stable, logical element.
- Debugging and anti-pattern prevention using patterns and references to diagnose why items don’t receive focus and to avoid common focus regressions.
Quick Start
Use @FocusState with an explicit default focus target, restore focus in .onDisappear after sheets/popovers, and apply focusSection() on macOS/tvOS when directional navigation would otherwise skip or jump to the wrong group.