All Projects → JunsW → SKSearchController

JunsW / SKSearchController

Licence: MIT license
A Wrap for UISearchController makes all customization super easy.

Programming Languages

swift
15916 projects
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to SKSearchController

Scikit Geometry
Scientific Python Geometric Algorithms Library
Stars: ✭ 220 (+780%)
Mutual labels:  wrapper
Echarts Php
Echarts-PHP a PHP library that works as a wrapper for the Echarts js library
Stars: ✭ 253 (+912%)
Mutual labels:  wrapper
AppStoreSearch
An example implementation of the iOS 11 App Store Search tab
Stars: ✭ 108 (+332%)
Mutual labels:  uisearchcontroller
Zenpy
Python wrapper for the Zendesk API
Stars: ✭ 222 (+788%)
Mutual labels:  wrapper
Alertift
Swifty, modern UIAlertController wrapper.
Stars: ✭ 242 (+868%)
Mutual labels:  wrapper
Mipp
MIPP is a portable wrapper for SIMD instructions written in C++11. It supports NEON, SSE, AVX and AVX-512.
Stars: ✭ 253 (+912%)
Mutual labels:  wrapper
Material Ripple
Android L Ripple effect wrapper for Views
Stars: ✭ 2,344 (+9276%)
Mutual labels:  wrapper
CapMonsterCloud
a C# wrapper for CapMonster Cloud API
Stars: ✭ 17 (-32%)
Mutual labels:  wrapper
Nimterop
Nimterop is a Nim package that aims to make C/C++ interop seamless
Stars: ✭ 244 (+876%)
Mutual labels:  wrapper
node-destiny-2
🌑 A zero dependency Destiny 2 API wrapper written in Node.js
Stars: ✭ 23 (-8%)
Mutual labels:  wrapper
Nodehun
The Hunspell binding for NodeJS that exposes as much of Hunspell as possible and also adds new features. Hunspell is a first class spellcheck library used by Google, Apple, and Mozilla.
Stars: ✭ 229 (+816%)
Mutual labels:  wrapper
Await Of
await wrapper for easier errors handling without try-catch
Stars: ✭ 240 (+860%)
Mutual labels:  wrapper
libpassqlite
libPasSQLite is delphi and object pascal bindings and wrapper around SQLite library. SQLite is library that implements a small, fast, self-contained, high-reliability, full-featured, SQL database engine.
Stars: ✭ 18 (-28%)
Mutual labels:  wrapper
Api struct
API wrapper builder with response serialization
Stars: ✭ 224 (+796%)
Mutual labels:  wrapper
cargo-limit
Cargo with less noise: warnings are skipped until errors are fixed, Neovim integration, etc.
Stars: ✭ 105 (+320%)
Mutual labels:  wrapper
Cacheable Request
Wrap native HTTP requests with RFC compliant cache support
Stars: ✭ 218 (+772%)
Mutual labels:  wrapper
Bus
Bus 是一个基础框架、服务套件,它基于Java8编写,参考、借鉴了大量已有框架、组件的设计,可以作为后端服务的开发基础中间件。代码简洁,架构清晰,非常适合学习使用。
Stars: ✭ 253 (+912%)
Mutual labels:  wrapper
gw
A Wrapper of a command to watch any changes in filesystem
Stars: ✭ 16 (-36%)
Mutual labels:  wrapper
vue-cryptojs
A small wrapper for integrating crypto-js into VueJS
Stars: ✭ 17 (-32%)
Mutual labels:  wrapper
PowerSchool-API
A Node.js library for interacting with the PowerSchool SIS API.
Stars: ✭ 21 (-16%)
Mutual labels:  wrapper

SKSearchController

Logo

Build Pass Language

A Wrap for UISearchController makes all customization super easy.

Demo

Dwonload and check out the demo project.

Demo

Requirements

  • iOS 8.0+
  • Swift 4.0+

Installation

Cocoapods

Pod `SKSearchController`

Manual

Download two .swift files in Source.

Usage

1. Initialization.

Toltally same initilizers as UISearchController
var searchController = SKSearchController(searchResultsController: nil)

2. Setup

All the setups must be done in the ViewDidAppear:. Some seting would be unavailable otherwise.


    func setupSearchController() {
        searchController.placeholder = "SKSearchController Demo"
        searchController.customizeCancelButton = { button in
            button.setAttributedTitle(NSAttributedString(string: "Punch", attributes: [.foregroundColor : UIColor.white, .font: UIFont.systemFont(ofSize: 15)]), for: .normal)
            button.backgroundColor = UIColor(hex: 0xEE7F79)
            button.layer.cornerRadius = 4
        }

        searchController.barBackgroundColor = UIColor(hex: 0xF9F9FA)
        
        searchController.leftIcon = UIImage(named: "football")
        searchController.leftIconColor =  UIColor(hex: 0xEE7F79)
        searchController.setRightBookmarkIcon(image: UIImage(named: "speaker"), color: UIColor(hex: 0xEE7F79), for: [UIControlState.normal])
        searchController.setRightClearIcon(image: UIImage(named: "x"), color: UIColor(hex: 0xEE7F79), for: [UIControlState.normal])
        
        searchController.cursorColor = UIColor(hex: 0x333333)
        searchController.textFieldTextColor = UIColor(hex: 0xbbbbbb)
        searchController.hideBorderLines = true
        searchController.textFieldBackgroundColor = UIColor(hex: 0xF9F9FA)
        
        searchController.searchTextDidChange = { searchBar, text in
            print("Keyword: \(text)")
        }
    }
    
    override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)
        // Do the settings here. Some settings could be unavailable otherwise.
        setupSearchController()
    }

Documents

1. Properties

TextField

  • textFieldBackgroundColor: Backgournd color of textField in searchControler's searchBar
  • textFieldCornerRadius: corner radius of the textField
  • textFieldTextColor: text color of textField
  • textFieldFont: text font of textField
  • cursorColor: Set cursor color by changing the tint color of the searchField
  • placeholder: set up the placeholder of the searchBar
  • attributedPlaceholder: set up the attributedPlaceholder of the textField

CancelButton

  • showCancelButtonWhileEditing: determing whether shows the cancel button or not.
  • customizeCancelButton: (UIButton)->(): a clourse help you setup the cancel button
  • cencelButtonAttributedTitle: This attribute only valid when customizeCancelButton block is nil
  • cancelButtonColor: This attribute only valid when customizeCancelButton block and cencelButtonAttributedTitle are both nil
  • cancelButtonTitle: This attribute only valid when customizeCancelButton block and cencelButtonAttributedTitle are both nil

Icons

  • leftIcon: Set a image to the left search icon.
  • rightClearIcon: Set a image to the clear icon showed while you are typing
  • rightBookmarkIcon: Set a image to the bookmark icon showed on the right of the search field.

Bar

  • hideBorderLines: whether hide the upper and lower border line of the searchBar
  • barBackgroundColor: set the search bar background, only working on iOS 11 and lower
  • universalBackgoundColor: set the search bar and the navigationBar background. This attribute will also set searchBar.isTranslucent to false on iOS 11 and lower
  • hideNavitionBarBottomLine: whether hide the bottom line of the navigationBar

2. Methods

func setLeftIcon(image: UIImage?, color: UIColor?, for states: [UIControlState]) Set a image to the left search icon. The icon will be redered in the color if it's not nil.

func setRightBookmarkIcon(image: UIImage?, color: UIColor?, for states: [UIControlState]) Set a image to the right bookmark icon. The icon will be redered in the color if it's not nil.

func setRightClearIcon(image: UIImage?, color: UIColor?, for states: [UIControlState]) Set a image to the right clear icon. The icon will be redered in the color if it's not nil.

3. UISearchBar Delegate

The delegate methods of UISearchBar has been convert to closures like below

typealias EmptySearchBarHandler = (UISearchBar)->()
typealias BoolSearchBarHandler = (UISearchBar)->(Bool)

public var searchButtonClickHandler: EmptySearchBarHandler?
public var searchBarShouldBeginEditingHandler: BoolSearchBarHandler?
public var searchBarShouldEndEditingHandler: BoolSearchBarHandler?
public var searchBarCancelButtonClickHandler: EmptySearchBarHandler?

public var searchTextDidChange: ((UISearchBar, String)->())?
public var searchTextShouldChangeInRange: ((UISearchBar, NSRange, String)->(Bool))?

So set it up like this

searchController.searchTextDidChange = 
{ searchBar, text in
        print("Content: \(text)")
}

Simple and efficient

Todo

  • Objective-C version
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].