I read this question: How to hide keyboard in swift on pressing return key?
and basically there are 2 ways to answer:
self.view.endEditing(true) is less efficient because it will cycle through the entire view hierarchy and makes sure anything that can be a firstRepsonder has resigned it.
If you know which item is currently the responder, it is more efficient and better practice to call
resignFirstResponder on it directly.