In an application we are developing, we would like to show a (non-interactable) textfield when a hardware keyboard is connected to the iPad.
Therefore my question:
Using SwiftUI, is it possible to detect the presence of a hardware keyboard and store that state inside a boolean like isHardwareKeyboardConnected?
Hi @Dokug,
To detect the presence of a hardware keyboard, you can utilize the isHardwareKeyboardInputExpected property. It signifies that a hardware keyboard is connected and available for input.
It's part of UIKit, but you could, for example, use .onReceive in SwiftUI to monitor the keyboardWillShow notification, and update a @State property accordingly.
Best,
-J