title: Curve search bar Swift 4
body: <p>i had problem to change my search bar design programatically on navigation controller. i just want to make the search bar curve like image below:</p>
  
  <p><a href="https://i.stack.imgur.com/gL19c.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gL19c.png" alt="enter image description here"></a></p>
  
  <p>i had try a lot of example in stack overflow, but i still failed to change the shape. Here what it looks like now:</p>
  
  <p><a href="https://i.stack.imgur.com/5uE2J.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5uE2J.png" alt="enter image description here"></a></p>
  
  <p>and here is the source code, on what have already done:</p>
  
  <pre><code>//MARK for searchBar UI
      searchController.dimsBackgroundDuringPresentation = false
      searchController.hidesNavigationBarDuringPresentation = false
      searchController.searchBar.placeholder = " Search for programs..."
      searchController.searchBar.sizeToFit()
      searchController.searchBar.isTranslucent = false
      searchController.searchBar.backgroundImage = UIImage()
      searchController.searchBar.delegate = self
      navigationItem.titleView = searchController.searchBar
      self.searchController.searchBar.layer.cornerRadius = 20.0
      self.searchController.searchBar.clipsToBounds = true
      // SearchBar text
      let textFieldInsideUISearchBar = searchController.searchBar.value(forKey: "searchField") as? UITextField
      textFieldInsideUISearchBar?.borderStyle = .roundedRect
      textFieldInsideUISearchBar?.font = textFieldInsideUISearchBar?.font?.withSize(14)
  </code></pre>
  
  <p>and now, i really have no idea how to change it, thanks in advance.</p>