diff --git a/Sources/TimecodeKitUI/SwiftUI/TimecodeField/TimecodeField ComponentView.swift b/Sources/TimecodeKitUI/SwiftUI/TimecodeField/TimecodeField ComponentView.swift index 5f38ff85..9d6ce151 100644 --- a/Sources/TimecodeKitUI/SwiftUI/TimecodeField/TimecodeField ComponentView.swift +++ b/Sources/TimecodeKitUI/SwiftUI/TimecodeField/TimecodeField ComponentView.swift @@ -69,9 +69,9 @@ extension TimecodeField { #elseif os(iOS) || os(visionOS) ZStack { KeyboardInputView( - keyboardType: .decimalPad + keyboardType: .decimalPad // note that on iPadOS this also contains extended chars ) { keyEquivalent in - handleKeyPress(key: keyEquivalent) + _ = handleKeyPress(key: keyEquivalent) } .onKeyPress(phases: [.down, .repeat]) { keyPress in // only handle hardware keyboard keys that aren't already handled by KeyboardInputView. diff --git a/Sources/TimecodeKitUI/Utilities/KeyboardInputView.swift b/Sources/TimecodeKitUI/Utilities/KeyboardInputView.swift index 17dcd5b6..2c29c6e9 100644 --- a/Sources/TimecodeKitUI/Utilities/KeyboardInputView.swift +++ b/Sources/TimecodeKitUI/Utilities/KeyboardInputView.swift @@ -124,6 +124,15 @@ struct KeyboardInputView: UIViewRepresentable { keyPressed(.delete) } + // forward return key + func textFieldShouldReturn(_ textField: UITextField) -> Bool { + keyPressed(.return) + return false + } + + // TODO: could forward this in the future as well + // func textFieldShouldClear(_ textField: UITextField) -> Bool { } + override var hasText: Bool { true } } }