func textFieldShouldReturn(_ textfield: UITextField) -> Bool{
p1s1TextField.resignFirstResponder()
return true
}
func textFieldShouldReturn(_ textfield: UITextField)-> Bool{
p2s1TextField.resignFirstResponder()
return true
}
So this is the code I need to write, the only difference being that they affect two different text fields. I understand I need to change the sender in order to avoid the redeclaration error but am unsure what to change it to.
Just use one of them and the parameter textfield
is your current textfield
.
So:
func textFieldShouldReturn(_ textfield: UITextField) -> Bool {
textfield.resignFirstResponder()
return true
}