PYSearch
  • October 24, 2023
  • 🔍 An elegant search controller for iOS.

QQ chat room


Features


  •  Support a variety of hot search style
  •  Support a variety of search history style
  •  Support a variety of search results display mode
  •  Support a variety of search view controller display mode
  •  Support search suggestions
  •  Support search history (record) cache
  •  Support callback using delegate or block completion search
  •  Support CocoaPods
  •  Support localization
  •  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


Renderings


Styles


Hot search style

How to use


  • Use CocoaPods:
    • pod "PYSearch"
    • Import the main file:#import <PYSearch.h>
  • 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)


// 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

// 1. Set dataSource
searchViewController.dataSource = self;
// 2. Implement dataSource method

  • Custom search result dispaly

// 1. Set searchResultShowMode
searchViewController.searchResultShowMode = PYSearchResultShowModeEmbed;
// 2. Set searchResultController
searchViewController.searchResultController = [[UIViewController alloc] init];

  • Set hotSearchStyle(default is PYHotSearchStyleNormalTag)

// Set hotSearchStyle
searchViewController.hotSearchStyle = PYHotSearchStyleColorfulTag;

  • Set searchHistoryStyle(default is PYSearchHistoryStyleCell)

// Set searchHistoryStyle
searchViewController.searchHistoryStyle = PYSearchHistoryStyleBorderTag;

  • Set searchHistoriesCachePath(default is PYSEARCH_SEARCH_HISTORY_CACHE_PATH)

// Set searchHistoriesCachePath
searchViewController.searchHistoriesCachePath = @”The cache path”;

  • Set searchHistoriesCount(default is 20)

// Set searchHistoriesCount
searchViewController. searchHistoriesCount = 6;

  • Set searchResultShowMode(default is PYSearchResultShowModeCustom)

// Set searchResultShowMode
searchViewController.searchResultShowMode = PYSearchResultShowModeEmbed;

  • Set searchSuggestionHidden(deafult is NO)

// Set searchSuggestionHidden
searchViewController.searchSuggestionHidden = YES;

GitHub


View Github

#animation #awesemetextfield #carthage #cocoapods #currencytextfield #customtextfield #growingtextview #interfacebuilder #ios #objectivec #passwordtextfield #pod #search #styledtext #swift #swiftpackagemanager #textexpansion #textfield #texture #textview #tjtextfield #ui #uikit #uitextfield #uitextfieldnavigation #uitextview
YOU MIGHT ALSO LIKE...
iPhoneNumberField ☎️

Format phone numbers as they're typed—entirely in SwiftUI. 📱 Get Started | Examples | Customize | Features | Install | Pricing And it's as easy as

CurrencyText

CurrencyText provides lightweight libraries for formating text field text as currency, available for both UIKit and SwiftUI. Its main core, the CurrencyFormatter class, can also ...

SlidingTabView

SlidingTabView is a simple Android-Like tab view that is built using the latest and greatest SwiftUI. Almost everything is customizable! Installation ...

StatefulTabView

A SwiftUI UITabBarController implementation that retains state between tab changes. Big thanks to Amzd and everyone who helped to refine this gist as it ...

FloatingTabBar

Previews