swift keyboard return key action code example
Example: xcode perform action when return key pressed text field
class SomeViewControllerClass : UIViewController, UITextFieldDelegate {
override func viewDidLoad() {
super.viewDidLoad()
self.textField.delegate = self
}
func textFieldShouldReturn(textField: UITextField) -> Bool {
//textField code
textField.resignFirstResponder() //if desired
performAction()
return true
}
func performAction() {
//action events
}
}