which method is called when we type a letter in text field swift code example
Example: xcode how to know which textfield is selected
class ViewController : UIViewController, UITextFieldDelegate {
var activeTextField = UITextField()
func textFieldDidBeginEditing(textField: UITextField) {
self.activeTextField = textField
}
func anotherMethod() {
if let activeTextFieldText = self.activeTextField.text {
print("Active text field's text: \(activeTextFieldText)")
return;
}
print("Active text field is empty")
}
}