feat(event): add key press APIs and keyboard shortcut bindings - #1067
Conversation
|
👀 Human review needed JustificationThis is a large feature PR (+1339 / −197 across 14 files, 8 commits) that introduces substantial new public API surface and modifies core framework infrastructure, so it falls outside any automatic low-risk classification.
Reviewed commit 709227f |
b1b995c to
b58ceeb
Compare
🤖 Augment PR SummarySummary: Adds initial keyboard input and shortcut API surface intended to match SwiftUI. Changes:
🤖 Was this summary useful? React with 👍 or 👎 |
| phases: KeyPress.Phases, | ||
| action: @escaping (KeyPress) -> KeyPress.Result | ||
| ) -> some View { | ||
| modifier(KeyPressModifier(handler: .init(subject: subject, phases: phases, action: action))) |
There was a problem hiding this comment.
Sources/OpenSwiftUI/Event/InputEvent/Keyboard/KeyPressModifier.swift:129 — onKeyPress only appends a KeyPress.Handler to EnvironmentValues; no responder or ForwardedEventDispatcher reads keyPressHandlers, while the UIKit responder sends KeyEvent values to a manager with no KeyEvent dispatcher. As a result, registrations through every overload are never matched or invoked at runtime.
Severity: medium
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
| action: @escaping () -> Void, | ||
| label: () -> V | ||
| ) -> some View where V: View { | ||
| modifier(KeyboardShortcutBindingBehavior(action: action, label: label())) |
There was a problem hiding this comment.
Sources/OpenSwiftUI/Event/InputEvent/Keyboard/KeyboardShortcut.swift:543 — keyboardShortcutBindingBehavior has no callers, and no host requests or consumes KeyboardShortcutBindingsKey (the current Button implementation is also an EmptyView). Therefore the public keyboardShortcut modifier only sets environment/trait state and never produces an executable shortcut binding.
Severity: medium
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
🛠️ Tuist Run Report 🛠️Tests 🧪
Builds 🔨
|
Add a fileprivate event conversion initializer for KeyPress tests and apply picker shortcut traits directly.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1067 +/- ##
==========================================
+ Coverage 29.92% 29.98% +0.05%
==========================================
Files 787 790 +3
Lines 62259 62423 +164
==========================================
+ Hits 18631 18717 +86
- Misses 43628 43706 +78 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
KeyPressandonKeyPressAPIs with handler registration, deprecated aliases, and parameterized coverage.ViewThatFitschild items under a parent item.KeyEquivalentwithKeyboardShortcut.Validation: Whitespace checks passed. Tests and builds were not rerun.