         return true
     }
     
+    func searchBarTextDidBeginEditing(_ searchBar: UISearchBar) {
+        setSearchResultsVisible(true, animated: true)
+    }
+    
+    func searchBarShouldEndEditing(_ searchBar: UISearchBar) -> Bool {
+        return canSearchBarEndEditing
+    }
+    
+    func searchBarTextDidEndEditing(_ searchBar: UISearchBar) {
+        setSearchResultsVisible(false, animated: true)
+    }
+    
     func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String) {
         search(for: searchBar.text, suggested: false)
     }

        let sucess = { (results: WMFSearchResults, type: WMFSearchType) in
            DispatchQueue.main.async {
                commonCompletion()
                self.areResultsVisible = true
                self.fakeProgressController.finish()
                guard
                    let resultsArray = results.results,

    
    var nonSearchAlpha: CGFloat = 1 {
        didSet {
            collectionView.alpha = nonSearchAlpha
            resultsViewController.view.alpha = nonSearchAlpha
            navigationBar.backgroundAlpha = nonSearchAlpha
        }
    }
