title: Show search bar with action (bar item)
body: <p>I have a problem with search bar. I need to create a table view with a search button in the right corner, and when I click on it, it should show the search bar.</p>
  
  <p>My code is here:</p>
  
  <pre><code>// Search controller
  searchController = ({
      let controller = UISearchController(searchResultsController: nil)
      controller.delegate = self
      controller.searchBar.delegate = self
      controller.searchResultsUpdater = self
      controller.dimsBackgroundDuringPresentation = false         
      controller.hidesNavigationBarDuringPresentation = true
      controller.searchBar.sizeToFit()
      return controller
  })()
  </code></pre>
  
  <p>And here is action:</p>
  
  <pre><code>// Search action
  @IBAction func search(sender: UIBarButtonItem) {
      print("Open search")
      searchController.active = true
      if searchController.searchBar.isFirstResponder() == false {
          searchController.searchBar.becomeFirstResponder()
      }
  }
  </code></pre>
  
  <p>When I click on the button, nothing happens (only prints text in console), and what I want is in the image below:</p>
  
  <p><a href="https://i.stack.imgur.com/eHC64.png" rel="noreferrer"><img src="https://i.stack.imgur.com/eHC64.png" alt="Show search"></a></p>