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


    override func viewWillAppear(animated: Bool) {
        getLocation()
    }

    @objc private func getLocation(){


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()
    }
}

