Anokrize Anokrize - 5 months ago 12x
Swift Question

Textfield delegate swift

currently I am trying to detect when a textield gets tapped.
So I am having multiple textfields and if one of them gets the focus then I want to call a function.
Currently I tried it with this code:

func textFieldDidBeginEditing(textField: UITextField!) { //delegate method

But this only works if the user starts writing. I want to print something if the textfield gots the focus (its getting tapped).

Does somebody know how to handle this?


Use this function

  func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool