I have this code:
extension VC : UISearchBarDelegate
{
func searchBarTextDidEndEditing(_ searchBar: UISearchBar) {
print("searchBarTextDidEndEditing")
}
func searchBarCancelButtonClicked(_ searchBar: UISearchBar) {
// searchBar.resignFirstResponder()
}
}
searchBarCancelButtonClicked
has fired when clicked on search , but searchBarTextDidEndEditing
has not fire until I call searchBar.resignFirstResponder()
I read a lot of questions and answers about that, but I did not understand why is that happen, and what is resignFirstResponder()
do here?