sl131
8/21/2019 - 3:42 PM

Hide keyboard

// HideKeyboard
// Вызовите self.hideKeyboard() в viewDidLoad
extension CalcViewController {
    func hideKeyboard()
    {
        let tap: UITapGestureRecognizer = UITapGestureRecognizer(
            target: self,
            action: #selector(CalcViewController.dismissKeyboard))
        
        tap.cancelsTouchesInView = false
        view.addGestureRecognizer(tap)
    }
    
    @objc func dismissKeyboard()
    {
        view.endEditing(true)
    }
}