I'm trying to identify which UITextField is being passed into the delegate function textFieldDidEndEditing(_:UITextField)
. I'm doing a comparison operation, but I'm not sure whether to use ==
, isEqual()
, or something else entirely.
I want to stress that I am comparing the UITextFields themselves to see if they are the same and not their text.
Here's the code as I have it now:
func textFieldDidEndEditing(_ textField: UITextField) {
if textField == titleTextField {
self.poll?.titleText = textField.text ?? ""
}
else {
self.poll?.allOptions[textField.tag].text = textField.text ?? ""
}
}