All Projects β†’ younatics β†’ Ynsearch

younatics / Ynsearch

Licence: mit
πŸ” Awesome fully customize search view like Pinterest written in Swift 5.0 + Realm support!

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Ynsearch

Search Ui
Search UI. Libraries for the fast development of modern, engaging search experiences.
Stars: ✭ 1,294 (+14.41%)
Mutual labels:  search, searchbar
Hiddensearchwithrecyclerview
Simple library to have a hidden/shown search bar
Stars: ✭ 220 (-80.55%)
Mutual labels:  search, searchbar
Modernsearchbar
The famous iOS search bar with auto completion feature implemented.
Stars: ✭ 167 (-85.23%)
Mutual labels:  search, searchbar
Rskcollectionviewretractablefirstitemlayout
A light-weight UICollectionViewFlowLayout subclass that allows the first item to be retractable.
Stars: ✭ 281 (-75.15%)
Mutual labels:  search, searchbar
Materialsearchbar
Material Design Search Bar for Android
Stars: ✭ 2,008 (+77.54%)
Mutual labels:  search, searchbar
Ionic Selectable
An Ionic-based versatile and highly customizable component that serves as a replacement to Ionic Select, and allows to search items, create items, customize the layout with templates and much more.
Stars: ✭ 459 (-59.42%)
Mutual labels:  search, searchbar
Instantsearch Ios Examples
Example apps built with InstantSearch iOS
Stars: ✭ 55 (-95.14%)
Mutual labels:  search
Middleman Search
LunrJS-based search for Middleman
Stars: ✭ 57 (-94.96%)
Mutual labels:  search
Quicknote
QuckNote allows you to quickly create and search tens of thousands of short notes.
Stars: ✭ 54 (-95.23%)
Mutual labels:  search
Search
A wrapper around Google's full text search API for App Engine
Stars: ✭ 52 (-95.4%)
Mutual labels:  search
Korea Startups
🌟 κ΅­λ‚΄ μŠ€νƒ€νŠΈμ—… λͺ©λ‘ 및 μ„€λͺ… 🌟
Stars: ✭ 63 (-94.43%)
Mutual labels:  search
Fuzzy Swift
πŸ” simple and fast fuzzy string matching in Swift
Stars: ✭ 61 (-94.61%)
Mutual labels:  search
Django Tsvector Field
Django field for tsvector (PostgreSQL full text search vector) with managed stored procedure and triggers.
Stars: ✭ 56 (-95.05%)
Mutual labels:  search
Open Semantic Search Apps
Python/Django based webapps and web user interfaces for search, structure (meta data management like thesaurus, ontologies, annotations and named entities) and data import (ETL like text extraction, OCR and crawling filesystems or websites)
Stars: ✭ 55 (-95.14%)
Mutual labels:  search
Realm Sync Samples
Code samples showing how to work with Realm Sync
Stars: ✭ 58 (-94.87%)
Mutual labels:  realm
Pinsharp
.NET client for working with the Pinterest API.
Stars: ✭ 54 (-95.23%)
Mutual labels:  pinterest
Stf Vue Select
stf vue select - most flexible and customized select
Stars: ✭ 61 (-94.61%)
Mutual labels:  search
React Emoji Search
πŸ¦„ A simple emoji search tool made with ReactJS.
Stars: ✭ 53 (-95.31%)
Mutual labels:  search
React Grid Table
A modular table, based on a CSS grid layout, optimized for customization.
Stars: ✭ 57 (-94.96%)
Mutual labels:  search
Fsq
A tool for querying the file system with a SQL-like language.
Stars: ✭ 60 (-94.69%)
Mutual labels:  search

YNSearch + Realm Support

Awesome Version Carthage Compatible License: MIT Build Status Platform Swift 5.0

Updates

See CHANGELOG for details

Intoduction

πŸ” Awesome search view, written in Swift 5.0, appears search view like Pinterest Search view. You can fully customize this library. You can also use this library with Realm! See usage in below

See Highlighter for highlight search result

demo2 demo demo3 demo4

Requirements

YNSearch is written in Swift 5.0. Compatible with iOS 8.0+

Installation

Cocoapods

YNSearch is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'YNSearch'

Carthage

github "younatics/YNSearch"

Simple Usage

Set categories (required) and search histories (optional)

import YNSearch

let demoDatabase = ["Menu", "Animation", "Transition", "TableView", "CollectionView", "Indicator", "Alert", "UIView", "UITextfield", "UITableView", "Swift", "iOS", "Android"]

ynSearch.setCategories(value: demoDatabase)
ynSearch.setSearchHistories(value: demoDatabase)

self.ynSearchinit()

Set database (required) and key (required). key will be displayed in YNSearchListView You can set your database [Any] if you want to customize.

let database1 = YNDropDownMenu(key: "YNDropDownMenu")
let database2 = YNSearchData(key: "YNSearchData")
let demoDatabase = [database1, database2]
        
self.initData(database: demoDatabase)

Set YNSearchListView Delegate

func ynSearchListView(_ ynSearchListView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = self.ynSearchView.ynSearchListView.dequeueReusableCell(withIdentifier: YNSearchListViewCell.ID) as! YNSearchListViewCell
        if let ynmodel = self.ynSearchView.ynSearchListView.searchResultDatabase[indexPath.row] as? YNSearchModel {
            cell.searchLabel.text = ynmodel.key
        }
        
        return cell
}
    
func ynSearchListView(_ ynSearchListView: UITableView, didSelectRowAt indexPath: IndexPath) {
        if let ynmodel = self.ynSearchView.ynSearchListView.searchResultDatabase[indexPath.row] as? YNSearchModel, let key = ynmodel.key {
        // Call listview clicked based on key
        self.ynSearchView.ynSearchListView.ynSearchListViewDelegate?.ynSearchListViewClicked(key: key)
        
        // return object you set in database
        self.ynSearchView.ynSearchListView.ynSearchListViewDelegate?.ynSearchListViewClicked(object: self.ynSearchView.ynSearchListView.database[indexPath.row])
        
        // Append Search history
        self.ynSearchView.ynSearchListView.ynSearch.appendSearchHistories(value: key)
        }
}

Realm Usage

Get your Data with Realm

let datas = realm.objects(RealmModel.self)

Realm is not collection type so you need to convert it again with [Any]type. This will find all string in your RealmModel and show you results.

var dataArray = [Any]()
for data in datas {
        let searchModel = RealmModel()
            searchModel.author = data.author
            searchModel.detail = data.detail
            searchModel.title = data.title
            searchModel.type = data.type
            
            dataArray.append(searchModel)
        }
        
self.initData(database: dataArray)

I used Objectification for accurate search result. This library will get all data in your object and search if for us.

Done!

View Hierachy

YNSearchViewController: Inherit this viewcontroller 
|-- YNSearchTextFieldView: YNSearchTextField with cancel button
|   |-- YNSearchTextField: Search UITextfield
|   |-- cancelButton: Show when YNSearchTextField textFieldDidBeginEditing
|
|-- YNSearchView : get both YNSearchMainView and YNSearchListView
|   |-- YNSearchMainView: First view that you can see
|   |   |-- categoryLabel: Cateogry label
|   |   |-- [YNCategoryButton]: cateogory buttons
|   |   |-- searchHistoryLabel: Search history label
|   |   |-- [YNSearchHistoryView]: history views
|   |   |   |-- [YNSearchHistoryButton]: Search history button
|   |   |   |-- [closeButton]: Close button
|   |
|   |-- YNSearchListView: UITableview with search result

Custom Usage

set YNSearchDelegate if you want callback

self.delegate = self

func ynSearchHistoryButtonClicked(text: String) {
  print(text)
}
    
func ynCategoryButtonClicked(text: String) {
  print(text)
}
    
func ynSearchListViewClicked(text: String) {
  print(text)
}

func ynSearchListViewClicked(object: YNSearchModel) {
  print(object)
}

Set YNCategoryButton type.

self.ynSearchView.ynSearchMainView.setYNCategoryButtonType(type: .colorful)

See more usage in demo

You can fully customize this YNSearch based on view hierachy

References

Please tell me or make pull request if you use this library in your application :)

Highlighter

Objectification

MotionBook

Author

younatics Twitter

License

YNSearch is available under the MIT license. See the LICENSE file for more info.

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].