 
     override func viewWillAppear(animated: Bool) {
         getLocation()
+    }
+
+    override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
+        searchView.endEditing(true)
     }
 
     @objc private func getLocation(){


    private func constraintSearchBar(){
        searchView.snp_makeConstraints { (make) -> Void in
            make.width.equalTo(SCREEN_RECT().width-2*MARGIN())
            make.left.equalTo(MARGIN())
            make.bottom.equalTo((self.navigationController?.navigationBar)!)
        }


extension RestaurantViewController : UISearchBarDelegate{
    func searchBarTextDidBeginEditing(searchBar: UISearchBar) {
        searchBarConstraint?.uninstall()
        searchView.snp_updateConstraints { (make) -> Void in
//            make.left.equalTo(MARGIN())
            make.width.equalTo(SCREEN_RECT().width-2*MARGIN()-CANCELBUTTON_WIDTH())
//            make.bottom.equalTo((self.navigationController?.navigationBar)!)
            rightItem.hidden = false
        }
    }

    func searchBarTextDidEndEditing(searchBar: UISearchBar) {
        searchBarConstraint?.uninstall()
        searchView.snp_updateConstraints { (make) -> Void in
            make.width.equalTo(SCREEN_RECT().width-2*MARGIN())
            rightItem.hidden = true 
        }
//        constraintSearchBar()
    }

    @objc private func cancel(){
        rightItem.hidden = true
        searchView.endEditing(true)
        searchView.resignFirstResponder()
    }
}

