I ma trying to make search bar transparent in swift 4.
Here is my code
    let  searchBar = UISearchBar()
    searchBar.sizeToFit()
    searchBar.placeholder = "search
    searchBar.isTranslucent = true
    searchBar.barTintColor = UIColor.clear
    searchBar.backgroundColor = UIColor.clear
    self.tabBarController?.navigationItem.titleView = searchBar
It ia appears like this 

I want to implement search bar as in screenshot. Please can anyone suggest me on this.

completely transparent all part of uisearchbar :
searchBar.setSearchFieldBackgroundImage(UIImage(), for: .normal)
searchBar.setBackgroundImage(UIImage(), for: .any, barMetrics: .default)
Try this code:
searchBar.setSearchFieldBackgroundImage(UIImage(), for: .normal)
or:
UITextField.appearance(whenContainedInInstancesOf: [UISearchBar.self]).backgroundColor = .clear
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With