I\'m designing an iOS app and I want that when the return key is pressed in my iPhone it directs me to the next following text field.
I have found a couple of similar
Swift 4.2
This is a More Generic and Easiest Solution, you can use this code with any amount of TextFields. Just inherit UITextFieldDelegate and update the Textfield Tag according to the order and copy this function
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
let txtTag:Int = textField.tag
if let textFieldNxt = self.view.viewWithTag(txtTag+1) as? UITextField {
textFieldNxt.becomeFirstResponder()
}else{
textField.resignFirstResponder()
}
return true
}