Jack.Right Jack.Right - 7 months ago 37
Swift Question

how to call method on textfieldDidEndEditing

in my home page there are four textfield. but i want to call method when user write email in eamil textfield.

Note : i just want to call method only when user type email textfield. i dont want to call method on other textfield.

Here is what i tried ::

func textFieldDidEndEditing(textField: UITextField) {
emailVarification()
}


but by this code its calling method on every textfield.

PKT PKT
Answer

Just Put Condition for your textfield

func textFieldDidEndEditing(textField: UITextField) {
   if textField == txtEmail {  // OR with Tag like textfield.tag == 45
      emailVarification()
    }
}