How to trigger textFieldDidChangeSelection only for a specific UITextField?

In a view with multiple UITextField elements, textFieldDidChangeSelection will trigger for any editing done in any UITextField. Can we perform some action inside this function only when a certain UITextField is edited?

class MyViewController: UIViewController, UITextFieldDelegate {
    @IBOutlet weak var text1: UITextField!
    @IBOutlet weak var text2: UITextField!
    @IBOutlet weak var text2: UITextField!

     //..........

     func textFieldDidChangeSelection(_ textField: UITextField) {
          print(textField.text) // this code should run only for text1 for example
    }

}

Accepted Reply

Found the answer, pretty easy:

func textFieldDidChangeSelection(_ textField: UITextField) {
    if textField == text1 {
        print(textField.text) // this code should run only for text1 for example
    }
}

Replies

Found the answer, pretty easy:

func textFieldDidChangeSelection(_ textField: UITextField) {
    if textField == text1 {
        print(textField.text) // this code should run only for text1 for example
    }
}