Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ko1o/PYSearch

🔍 An elegant search controller which replaces the UISearchController for iOS (iPhone & iPad) .
https://github.com/ko1o/PYSearch

cocoapods ios objective-c pod search swift ui

Last synced: 3 months ago
JSON representation

🔍 An elegant search controller which replaces the UISearchController for iOS (iPhone & iPad) .

Awesome Lists containing this project

README

        




[![Apps Using](https://img.shields.io/badge/Apps%20Using-%3E%203,000-00BFFF.svg?style=plastic)](https://cocoapods.org/pods/PYSearch)
[![Total Downloads](https://img.shields.io/badge/Total%20Downloads-%3E%2060,000-00BFFF.svg?style=plastic)](https://cocoapods.org/pods/PYSearch)


[![Build Status](https://travis-ci.org/ko1o/PYSearch.svg?branch=master)](https://travis-ci.org/ko1o/PYSearch)
[![Pod Version](http://img.shields.io/cocoapods/v/PYSearch.svg?style=flat)](http://cocoadocs.org/docsets/PYSearch/)
[![Pod Platform](https://img.shields.io/badge/platform-iOS%207%2B-blue.svg?style=flat)](http://cocoadocs.org/docsets/PYSearch/)
[![Pod License](http://img.shields.io/cocoapods/l/PYSearch.svg?style=flat)](https://opensource.org/licenses/MIT)

- 🔍 An elegant search controller for iOS.

## QQ chat room
 

## Features
- [x] Support a variety of hot search style
- [x] Support a variety of search history style
- [x] Support a variety of search results display mode
- [x] Support a variety of search view controller display mode
- [x] Support search suggestions
- [x] Support search history (record) cache
- [x] Support callback using delegate or block completion search
- [x] Support CocoaPods
- [x] Support localization
- [x] Support vertical and horizontal screen on iPhone and iPad

## Requirements
* iOS 7.0 or later
* Xcode 7.0 or later

## Architecture
### Main
- `PYSearch`
- `PYSearchConst`
- `PYSearchViewController`
- `PYSearchSuggestionViewController`

### Category
- `UIColor+PYSearchExtension`
- `UIView+PYSearchExtension`
- `NSBundle+PYSearchExtension`

## Contents
* Getting Started
* [Renderings](#Renderings)
* [Styles](#Styles)

* Usage
* [How to use](#Howtouse)
* [Details (See the example program PYSearchExample for details)](#Details)
* [Custom](#Custom)

* [Hope](#Hope)

## Renderings

## Styles

#### Hot search style


#### Search history style


## How to use
* Use CocoaPods:
- `pod "PYSearch"`
- Import the main file:`#import `
* Manual import:
- Drag All files in the `PYSearch` folder to project
- Import the main file:`#import "PYSearch.h"`


## Details (See the example program PYSearchExample for details)
```objc
// 1. Create hotSearches array
NSArray *hotSeaches = @[@"Java", @"Python", @"Objective-C", @"Swift", @"C", @"C++", @"PHP", @"C#", @"Perl", @"Go", @"JavaScript", @"R", @"Ruby", @"MATLAB"];
// 2. Create searchViewController
PYSearchViewController *searchViewController = [PYSearchViewController searchViewControllerWithHotSearches:hotSeaches searchBarPlaceholder:@"Search programming language" didSearchBlock:^(PYSearchViewController *searchViewController, UISearchBar *searchBar, NSString *searchText) {
// Call this Block when completion search automatically
// Such as: Push to a view controller
[searchViewController.navigationController pushViewController:[[UIViewController alloc] init] animated:YES];

}];
// 3. present the searchViewController
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:searchViewController];
[self presentViewController:nav animated:NO completion:nil];

```

## Custom

* Custom search suggestions display
```objc
// 1. Set dataSource
searchViewController.dataSource = self;
// 2. Implement dataSource method
```

* Custom search result dispaly
```objc
// 1. Set searchResultShowMode
searchViewController.searchResultShowMode = PYSearchResultShowModeEmbed;
// 2. Set searchResultController
searchViewController.searchResultController = [[UIViewController alloc] init];
```

* Set hotSearchStyle(default is PYHotSearchStyleNormalTag)
```objc
// Set hotSearchStyle
searchViewController.hotSearchStyle = PYHotSearchStyleColorfulTag;
```

* Set searchHistoryStyle(default is PYSearchHistoryStyleCell)
```objc
// Set searchHistoryStyle
searchViewController.searchHistoryStyle = PYSearchHistoryStyleBorderTag;
```

* Set searchHistoriesCachePath(default is PYSEARCH_SEARCH_HISTORY_CACHE_PATH)
```objc
// Set searchHistoriesCachePath
searchViewController.searchHistoriesCachePath = @"The cache path";
```

* Set searchHistoriesCount(default is 20)
```objc
// Set searchHistoriesCount
searchViewController. searchHistoriesCount = 6;
```

* Set searchResultShowMode(default is PYSearchResultShowModeCustom)
```objc
// Set searchResultShowMode
searchViewController.searchResultShowMode = PYSearchResultShowModeEmbed;
```

* Set searchSuggestionHidden(deafult is NO)
```objc
// Set searchSuggestionHidden
searchViewController.searchSuggestionHidden = YES;
```

## Hope

- If you have any questions during the process or want more interfaces to customize,you can [issues me](https://github.com/iphone5solo/PYSearch/issues/new)!
- Instead of giving me star, it is better to throw a bug to me!
- If you want to participate in the maintenance of this project or have a good design style, welcome to pull request!
- If you feel slightly discomfort in use, please contact me QQ:499491531 or Email:[email protected].
- Hope to improve this project together, let it become more powerful, able to meet the needs of most users!

## Licenses
All source code is licensed under the MIT License.