Giter Site home page Giter Site logo

ashsearchedviewcontroller's Introduction

ASHSearchedViewController

Navigation bar-integrated search interface

ASHSearchedViewController is lightweight UIViewController subclass that provides a navigation bar-integrated searching interface with a search button, searchbar, cancel button and rich customization capabilities.

Example

First thing first - import the library:

import ASHSearchedViewController

Then, you should make your viewcontroller subclass of ASHSearchedViewController instead of UIViewController:

class MyViewController: ASHSearchedViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
    }


}

Finally, you should override searchControllerDidPerformSearch(with searchText: String) to provie actual implementation of your search:

override func searchControllerDidPerformSearch(with searchText: String) {
        print("Searched term: \(searchText)")
}

Requirements

ASHSearchedViewController works with iOS 9.0 or above.

Installation

CococaPods

Add to your podfile:

pod 'ASHSearchedViewController'

Customization

ASHSearchedViewController provides a handful of methods to override in order to customize appearance:

///Override to provide your custom color for the search button.
open var searchButtonTintColor: UIColor {
    return UIColor(red: 0, green: 122/255, blue: 1, alpha: 1)
}

///Override to provide your custom font for search button text and placeholder.
open var searchBarFont: UIFont {
    return UIFont.systemFont(ofSize: 16)
}

///Override to provide your custom placeholder for the search bar.
open var searchBarPlaceholder: String {
    return "Search"
}

///Override to provide your custom text for the cancel button.
open var searchBarCancelButtonText: String {
    return "Cancel"
}

///Override to provide your custom color for search bar placeholder text.
open var searchBarCursorColor: UIColor {
    return UIColor.lightGray
}

///Override to provide your custom color for search bar text.
open var searchBarTextColor: UIColor {
    return UIColor.black
}

///Override to provide your custom color search bar for cancel button.
open var searchBarCancelButtonColor: UIColor {
    return UIColor(red: 0, green: 122/255, blue: 1, alpha: 1)
}

///Override to provide your custom font for search bar cancel button.
open var searchBarCancelButtonFont: UIFont {
    return UIFont.boldSystemFont(ofSize: 16)
}

License

ASHSearchedViewController is licensed under MIT License.

Contact

[email protected]

ashsearchedviewcontroller's People

Contributors

xedart avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.