HidekeyboardWhenTappedAround

Run Settings
LanguageSwift
Language Version
Run Command
// Hide keyboard when you click outside the keyboard extension UIViewController { func hideKeyboardWhenTappedAround() { let tap: UITapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(UIViewController.dismissKeyboard)) tap.cancelsTouchesInView = false view.addGestureRecognizer(tap) } @objc func dismissKeyboard() { view.endEditing(true) } func goToTabBarView(inStoryboard storyboard: String, withIdentifier identifier: String) { let storyBoard : UIStoryboard = UIStoryboard(name: storyboard, bundle:nil) let nextViewController = storyBoard.instantiateViewController( withIdentifier: identifier) as! UITabBarController self.present(nextViewController, animated:true, completion:nil) } func performSegueToReturnBack() { if let nav = self.navigationController { nav.popViewController(animated: true) } else { self.dismiss(animated: true, completion: nil) } } }
Editor Settings
Theme
Key bindings
Full width
Lines