Latest 1.2.5
Homepage https://github.com/daoseng33/DAOSearchBar
License WTFPL
Platforms ios 10.0
Frameworks UIKit
Authors

INSSearchBar is a 3rd-party search bar with beautiful animation. Unfortunately, it seems like INSSearchBar is no longer update anymore.

So, heres the DAOSearchBar.

withoutDelegate
withDelegate
customColor

Requirement

  • iOS 9.0 up

  • Swift 3.0 up (Support Swift 4.0)

  • XCode 8 up

Installation

CocoaPods

pod 'DAOSearchBar', '~> 1.2.5'

Usage

Search bar without delegate

self.searchBarWithoutDelegate.frame = CGRect(x: 20.0, y: 64.0, width: self.view.bounds.width - 40.0, height: 34.0)

self.view.addSubview(self.searchBarWithoutDelegate)

Search bar with delegate

class ViewController: UIViewController, DAOSearchBarDelegate {}
self.searchBarWithDelegate.frame = CGRect(x: 20.0, y: 184.0, width: 44.0, height: 34.0)
self.searchBarWithDelegate.delegate = self;

self.view.addSubview(self.searchBarWithDelegate)

Custom color

self.searchBarWithCustomColor.searchOffColor = UIColor.darkGray
self.searchBarWithCustomColor.searchOnColor = UIColor.white
self.searchBarWithCustomColor.searchBarOffColor = UIColor.white
self.searchBarWithCustomColor.searchBarOnColor = UIColor.darkGray

Delegate

func destinationFrameForSearchBar(_ searchBar: DAOSearchBar) -> CGRect
{
return CGRect(x: 20.0, y: 184.0, width: self.view.bounds.size.width - 40.0, height: 34.0)
}
 func searchBar(_ searchBar: DAOSearchBar, willStartTransitioningToState destinationState: DAOSearchBarState)
    {
        // Do whatever you deem necessary.
    }
 func searchBar(_ searchBar: DAOSearchBar, didEndTransitioningFromState previousState: DAOSearchBarState)
    {
        // Do whatever you deem necessary.
    }
 func searchBarDidTapReturn(_ searchBar: DAOSearchBar)
    {
        // Do whatever you deem necessary.
        // Access the text from the search bar like searchBar.searchField.text  
    }
 func searchBarTextDidChange(_ searchBar: DAOSearchBar)
    {
        // Do whatever you deem necessary.
        // Access the text from the search bar like searchBar.searchField.text
    }

Latest podspec

{
    "name": "DAOSearchBar",
    "version": "1.2.5",
    "summary": "A search bar with beautiful animation.",
    "homepage": "https://github.com/daoseng33/DAOSearchBar",
    "screenshots": "https://media.giphy.com/media/3o6vXWksaIn9OFF78I/giphy.gif",
    "license": "WTFPL",
    "authors": {
        "daoseng33": "[email protected]"
    },
    "platforms": {
        "ios": "10.0"
    },
    "source": {
        "git": "https://github.com/daoseng33/DAOSearchBar.git",
        "tag": "1.2.5"
    },
    "source_files": "DAOSearchBar/**/*",
    "frameworks": "UIKit",
    "resources": "DAOSearchBar/Resources/DAOSearchBar.bundle"
}

Pin It on Pinterest

Share This