I have several UITextFields (with outlets) in a viewController and want to use shouldChangeTextIn
to validate user input (similar to Allow only Numbers for UITextField input).
How can I identify which textField was selected? (If possible, I would prefer to identify it by the outlet name I gave it and not have to resort to using tags.)
@IBOutlet weak var fld1: UITextView!
// more outlets ...
@IBOutlet weak var fld20: UITextView!
textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) {
print("textField \(outletName) was modified")
}