Skip to content
The search bar that doesn't suck.
Branch: develop
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
Example Add localization Dec 17, 2018
SHSearchBar.xcodeproj Fastlane: Release on Production 1.6.0 Dec 18, 2018
SHSearchBar.xcworkspace Restructure project to enable pod try and Carthage Dec 17, 2018
Source Fastlane: Release on Production 1.6.0 Dec 18, 2018
Tests Fastlane: Release on Production 1.6.0 Dec 18, 2018
fastlane Remove unsused config files Nov 9, 2018
github Add github template files Mar 11, 2018
.codecov.yml Fix codecov.yml Sep 30, 2018
.gitignore Add coverage report to gitignore Dec 18, 2018
AUTHORS Add Authors File Nov 9, 2018 Fastlane: Release on Production 1.6.0 Dec 18, 2018
Gemfile Add new gems Feb 15, 2018
Gemfile.lock Update pods Dec 18, 2018
LICENSE Update License file Mar 11, 2018
Podfile Set deployment target to 10 Dec 17, 2018
Podfile.lock Update pods Dec 18, 2018 Add Carthage installation instructions Dec 24, 2018
SHSearchBar.podspec Fastlane: Release on Production 1.6.0 Dec 18, 2018
icon.png Update source tree icon Dec 13, 2018


Build Status Github Current Release Cocoapods Platforms Xcode 10.0+ iOS 10.0+ Swift 4.2+ Github Repo Size Github Code Size Github Closed PR's Carthage compatible License Codebeat Downloads Donate

The clean and shiny search bar that does what UISearchBar does only with dirty hacks. This view is designed to tackle the customization limits of UISearchBar. The difference here is that this class does not inherit UISearchBar but composes a new UIView object by using a UITextField that is much easier to use. These are the limits of the UISearchBar:

  • no clean way to left align the placeholder
  • the cancel button is hard to taylor to your needs
  • generally the appearance is not customizable (e.g. the font of the text)
  • there are some strange behaviours when you set a custom background image

Since I use a UITextField these restrictions do not apply.


SHSearchBar is compatible with iOS 9 or higher and builds with Xcode 9 and Swift 4 syntax. It is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "SHSearchBar"


Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. To integrate SHSearchBar into your Xcode project using Carthage, specify it in your Cartfile:

github "Blackjacx/SHSearchBar"


The repo includes an example project. It shows shows different use cases of the searchbar. To run it, just type pod try SHSearchBar in your console and it will be cloned and opened for you. The following images show some of these use cases:

You can show a custom placeholder like for normal text fields:

And you can even type text into that searchbar:

Wow there are customizable accessory views too:
Accesssory Icon

Easily customize text and cancel button as you want:
Customizable text and ancel button

You can customize each corner radius of the text field so that layouts like this become an ease:
Corner Radius Customization

The inner text field supports the new iOS 10 'textContentMode':
(Re-uses the address searched in Apple Maps before)
UITextContentMode Support

You can use the search bar inside a UINavigationBar:
UINavigationBar Support


  • If you found a bug, please open an issue.
  • If you have a feature request, please open an issue.
  • If you want to contribute, please submit a pull request.


Stefan Herold@Blackjacxxx


SHSearchBar is available under the MIT license. See the LICENSE file for more info.

You can’t perform that action at this time.