mirror of https://github.com/oxen-io/session-ios
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
781 B
Swift
27 lines
781 B
Swift
3 years ago
|
import UIKit
|
||
|
|
||
|
extension HomeVC: UISearchBarDelegate, GlobalSearchViewDelegate {
|
||
|
|
||
|
func GlobalSearchViewWillBeginDragging() {
|
||
|
|
||
|
}
|
||
|
|
||
|
// MARK: UISearchBarDelegate
|
||
|
|
||
|
func searchBarTextDidBeginEditing(_ searchBar: UISearchBar) {
|
||
|
self.ensureSearchBarCancelButton()
|
||
|
}
|
||
|
|
||
|
func searchBarCancelButtonClicked(_ searchBar: UISearchBar) {
|
||
|
searchBar.text = nil
|
||
|
searchBar.resignFirstResponder()
|
||
|
self.ensureSearchBarCancelButton()
|
||
|
}
|
||
|
|
||
|
func ensureSearchBarCancelButton() {
|
||
|
let shouldShowCancelButton = searchBar.isFirstResponder
|
||
|
guard searchBar.showsCancelButton != shouldShowCancelButton else { return }
|
||
|
self.searchBar.setShowsCancelButton(shouldShowCancelButton, animated: true)
|
||
|
}
|
||
|
}
|