Couple options, but one approach is to implement touchesBegan instead of adding a tap gesture:
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
if insertFld.isFirstResponder
{
insertFld.resignFirstResponder()
insertFld.text = ""
insertButton.isEnabled = false
// print("They emptied the fld when editing", gItemID)
gItemID = 0
insertButton.filled_Red_Back(title: K.Titles.add_Btn)
theOriginal_Text = ""
}
}
Any UI element that responds to touch (the field, button, collection view, etc) will consume the touch, so touchesBegan will only be triggered when touching the view itself (or some other non-interactive element).
Topic:
UI Frameworks
SubTopic:
UIKit
Tags: