HomeiOS Developmentios - Make a view default first responder when no textfield is...

ios – Make a view default first responder when no textfield is lively


I am making an attempt so as to add keyboard shortcut assist to my app utilizing override func pressesEnded(_ presses: Set<UIPress>, with occasion: UIPressesEvent?). The explanation I can’t use SwiftUI’s keyboardShortcut or UIKeyCommand is that they do not assist single-key press. Nonetheless, the view with this methodology carried out will lose the primary responder privilege when a textual content discipline is chosen and will not achieve the primary responder once more after the textual content discipline is completed enhancing. I can connect delegate to UITextField and use onCommit of View to reassign the primary responder, however I am going to have to do that manually for each textual content discipline within the app.

So my query is do we have now a technique to make a view the default first responder? it’s going to has decrease precedence than textual content fields, however as quickly as no textual content discipline is concentrated, it’s the first responder. My app is a SwiftUI app with some UIKit View right here and there.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments