title: iOS Swift: SearchController with a StoryBoard UISearchBar
body: <p>Evening, I have built a <strong>search controller</strong>, and I have also the code to programmatically create his <strong>search bar</strong>. But I would like to replace this code with a search bar designed in the <strong>story board</strong>.</p>
  
  <p><strong>So my question is, how can I connect the outlet to the search controller?</strong></p>
  
  <p>this is my code:</p>
  
  <pre><code>public class CustomSearchController: UISearchController {
  
      public var customSearchBar = UISearchBar()
  
      override public var searchBar: UISearchBar {
          get {
              return self.customSearchBar
          }
      }
  }
  
  func configureSearchController() {
  
      searchController = CustomSearchController()
      searchController.searchResultsUpdater = self
      searchController.dimsBackgroundDuringPresentation = false
      searchController.hidesNavigationBarDuringPresentation = false
      searchController.customSearchBar = self.customSearchBar
  
      searchController.searchBar.delegate = self
  
      self.definesPresentationContext = true
  
  }
  
  extension EarthSearcherTableViewController : UISearchResultsUpdating {
  
      public func updateSearchResults(for searchController: UISearchController) {
          //Code
          guard let text = searchController.searchBar.text else { return }
  
          self.getLocations(forSearchString: text)
      }
  
      fileprivate func getLocations(forSearchString searchString: String) {
  
          let request = MKLocalSearchRequest()
          request.naturalLanguageQuery = searchString
          request.region = mapView.region
  
          let search = MKLocalSearch(request: request)
          search.start { (response, error) in
  
              guard let response = response else { return }
              self.locations = response.mapItems
              self.tableView.reloadData()
          }
      }
  
      @objc func zoomToCurrentLocation() {
  
  
          //Clear existing pins
          mapView.removeAnnotations(mapView.annotations)
          mapView.removeOverlays(mapView.overlays)
  
          let annotation = MKPointAnnotation()
          annotation.coordinate = mapView.userLocation.coordinate
          mapView.addAnnotation(annotation)
  
          let span = MKCoordinateSpanMake(0.005, 0.005)
          let region = MKCoordinateRegionMake(mapView.userLocation.coordinate, span)
          mapView.setRegion(region, animated: true)
  
          let location = CLLocation(latitude: mapView.userLocation.coordinate.latitude, longitude: mapView.userLocation.coordinate.longitude)
          mapView.add(MKCircle(center: location.coordinate, radius: 50))
  
  
      }
  
  }
  </code></pre>
  
  <p>I think I have a problem with the delegates, because when I type in the search bar, the results does not show off in the table</p>
  
  <p>Any tips?</p>