 
 import UIKit
 
-class MasterViewController: UITableViewController, UISearchResultsUpdating,UISearchBarDelegate, NpmDataSourceDelegate {
+class MasterViewController: UITableViewController, UISearchControllerDelegate, UISearchResultsUpdating, UISearchBarDelegate, NpmDataSourceDelegate {
 
     var detailViewController: DetailViewController? = nil
     var objects = NSArray()

        
        self.resultSearchController = ({
            let controller = UISearchController(searchResultsController: nil)
            controller.searchResultsUpdater = self
            controller.dimsBackgroundDuringPresentation = false
            controller.searchBar.delegate = self

             self.performSegueWithIdentifier("showDetail", sender: nil)
        }
    }
    
    func willPresentSearchController(searchController: UISearchController) {
        if(filteredTableData.count > 0){
            objects = NSArray()
            filteredTableData.removeAll(keepCapacity: false)
            self.resultSearchController.searchBar.text = ""
            self.reloadTable()
        }
    }

    func updateSearchResultsForSearchController(searchController: UISearchController)
    {
