Popularity
5.5
Stable
Activity
8.3
Growing
472
49
25

Monthly Downloads: 0
Programming language: Swift
License: MIT License
Tags: UI     TextField & TextView    
Latest version: v5.1.0

InstantSearch iOS alternatives and similar libraries

Based on the "TextField & TextView" category

Do you think we are missing an alternative of InstantSearch iOS or a related project?

Add another 'TextField & TextView' Library

README

[InstantSearch iOS](./docgen/assets/img/instantsearch-banner.png)

By Algolia.

InstantSearch family: InstantSearch iOS | InstantSearch Android | React InstantSearch | InstantSearch.js | Angular InstantSearch | Vue InstantSearch.

InstantSearch iOS is a framework providing components and helpers to help you build the best instant-search experience on iOS with Algolia. It is built on top of Algolia's Swift API Client library to provide you a high-level solution to quickly build various search interfaces.

<!-- -->

Demo

You can see InstantSearch iOS in action in our Examples repository, in which we published search experiences built with InstantSearch and written in Swift:

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects.

To install InstantSearch, simply add the following line to your Podfile:

Swift 4.2+

pod 'InstantSearch', '~> 5.0'
# pod 'InstantSearch/UI' for access to everything
# pod 'InstantSearch/Core' for access to everything except the UI controllers
# pod 'InstantSearch/Client' for access only to the API Client

Swift 4.1

pod 'InstantSearch', '~> 2.0'
# pod 'InstantSearch/Widgets' for access to everything
# pod 'InstantSearch/Core' for access to everything except the UI widgets
# pod 'InstantSearch/Client' for access only to the API Client

Then, run the following command:

$ pod update

Carthage

Carthage is a simple, decentralized dependency manager for Cocoa.

To install InstantSearch, simply add the following line to your Cartfile:

Swift 4.2+

github "algolia/instantsearch-ios" ~> 5.0 # for access to everything
# github "algolia/instantsearch-core-swift" ~> 6.0 # for access to everything except the UI widgets
# github "algolia/algoliasearch-client-swift" ~> 7.0 # for access only to the API Client

Swift 4.1

github "algolia/instantsearch-ios" ~> 2.0 # for access to everything
# github "algolia/instantsearch-core-swift" ~> 3.0 # for access to everything except the UI widgets
# github "algolia/algoliasearch-client-swift" ~> 5.0 # for access only to the API Client

SwiftPM

The API client is the only library of the framework available on SwiftPM.

Swift 4.2+

To install the API Client, add .package(url:"https://github.com/algolia/algoliasearch-client-swift", from: "6.0.0") to your package dependencies array in Package.swift, then add AlgoliaSearch to your target dependencies.

Swift 4.1

To install the API Client, add .package(url:"https://github.com/algolia/algoliasearch-client-swift", from: "5.0.0") to your package dependencies array in Package.swift, then add AlgoliaSearch to your target dependencies.

Documentation

You can start with the Getting Started Guide.

Learn more about instantSearch iOS in the dedicated documentation website.

Basic Usage

In your ViewController.swift:

import InstantSearch

let searcher: SingleIndexSearcher = .init(appID: "latency",
                                          apiKey: "1f6fd3a6fb973cb08419fe7d288fa4db",
                                          indexName: "bestbuy")

let queryInputInteractor: QueryInputInteractor = .init()
let searchBarController: SearchBarController = .init(searchBar: UISearchBar())

let statsInteractor: StatsInteractor = .init()
let statsController: LabelStatsController = .init(label: UILabel())

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

func setup() {
    searcher.connectFilterState(filterState)

    queryInputInteractor.connectSearcher(searcher)
    queryInputInteractor.connectController(searchBarController)

    statsInteractor.connectSearcher(searcher)
    statsInteractor.connectController(statsController)

    searcher.search()
}

func configureUI() {

    view.backgroundColor = .white

    let stackView = UIStackView()
    stackView.translatesAutoresizingMaskIntoConstraints = false
    stackView.spacing = 16
    stackView.axis = .vertical
    stackView.layoutMargins = UIEdgeInsets(top: 0, left: 5, bottom: 0, right: 0)
    stackView.isLayoutMarginsRelativeArrangement = true

    let searchBar = searchBarController.searchBar
    searchBar.translatesAutoresizingMaskIntoConstraints = false
    searchBar.heightAnchor.constraint(equalToConstant: 40).isActive = true
    searchBar.searchBarStyle = .minimal
    stackView.addArrangedSubview(searchBar)

    let statsLabel = statsController.label
    statsLabel.translatesAutoresizingMaskIntoConstraints = false
    statsLabel.heightAnchor.constraint(equalToConstant: 16).isActive = true
    stackView.addArrangedSubview(statsLabel)

    stackView.addArrangedSubview(UIView())

    view.addSubview(stackView)

    NSLayoutConstraint.activate([
      stackView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor),
      stackView.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor),
      stackView.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor),
      stackView.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor),
    ])

}

Run your app and you will the most basic search experience: a UISearchBar with the number of results each time you write a query.

To get a more meaningful search experience, please follow our Getting Started Guide.

Getting Help

Getting involved

  • If you want to contribute please feel free to submit pull requests.
  • If you have a feature request please open an issue.
  • If you use InstantSearch in your app, we would love to hear about it! Drop us a line on discourse or twitter.

License

InstantSearch iOS is [Apache 2.0 licensed](LICENSE.md).


*Note that all licence references and agreements mentioned in the InstantSearch iOS README section above are relevant to that project's source code only.