         tableView.endUpdates()
     }
     
+    // search bar code
+    // following is the search logic. Its simple, uses filter
+    func filterContentForSearchText(searchText: String!) {
+        searchResults = restaurants.filter() { (restaurant: Restaurant) -> Bool in
+            let nameMatch = restaurant.name.rangeOfString(searchText, options: .CaseInsensitiveSearch)
+            return nameMatch != nil
+        }
+    }
+    
+    // When a user selects the search bar or makes any changes inside it, 
+    // this method will be called. By implementing the method, we can instruct
+    // the search controller to display the search results
+    func updateSearchResultsForSearchController(searchController: UISearchController) {
+        let searchText = searchController.searchBar.text
+        filterContentForSearchText(searchText)
+        tableView.reloadData()
+    }
+    
     override func prefersStatusBarHidden() -> Bool {
         return false
     }

    }
    */

    /*
    // Override to support conditional editing of the table view.
    override func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool {
        // Return NO if you do not want the specified item to be editable.
        return true
    }
    */

    /*
    // Override to support editing the table view.

        // on the view controller in which you want the search to be presented.
        definesPresentationContext = true
        
        searchController.searchResultsUpdater = self
        searchController.dimsBackgroundDuringPresentation = false
        
        // Uncomment the following line to preserve selection between presentations
        // self.clearsSelectionOnViewWillAppear = false

