How to hide keyboard when tap out of text field
extension View {
// hide keyboard when tap out of text field area
func hideKeyboard() {
UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil)
}
}