SwiftUI dismiss keyboard when tapping segmentedControl
问题 I have a TextField in SwiftUI that needs to use a different keyboard depending on the value of a @State variable determined by a SegementedControl() picker. How can I dismiss the keyboard (like send an endEditing event) when the user taps a different segment? I need to do this because I want to change the keyboard type and if the textField is the responder, the keyboard won't change. I have this extension: extension UIApplication { func endEditing() { sendAction(#selector(UIResponder