How to dismiss keyboard when touching anywhere outside UITextField (in swift)?
Edited for Swift 4 Edit: Added @objc. While this isn’t the best option for performance, one instance of it here shouldn’t cause too many problems until there is a better solution. Edited to fix when needing to interact with items behind GestureRecognizer. Edit: Thanks @Rao for pointing this out. Added tap.cancelsTouchesInView = false. This should … Read more