📜  如何关闭键盘 swiftui - Swift 代码示例

📅  最后修改于: 2022-03-11 15:00:59.388000             🧑  作者: Mango

代码示例1
#if canImport(UIKit)
extension View {
    func hideKeyboard() {
        UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil)
    }
}
#endif