What is InstantSearch iOS?
InstantSearch iOS is an open source UI library for iOS that lets you quickly build a search interface in your frontend application.
InstantSearch’s goal is to help you implement awesome search experiences as smoothly as possible by providing a complete search ecosystem. InstantSearch tackles an important part of this vast goal by providing frontend widgets that you can assemble into unique search interfaces.
The InstantSearch family is composed of multiple InstantSearch flavors:
InstantSearch iOS is a library that helps you integrate various search interfaces with Algolia, built on top of the Swift API client.
InstantSearch iOS provides out of the box components that work together: search box, list of results, filtering and sorting interfaces, hierarchical menu, federated search, suggestions, highlighting, loading and more. It connects to Algolia servers, performs API calls for you and automatically updates the user interface with the latest state.
InstantSearch iOS allows you to focus on the look and feel of your user interface, by handling the search-specific logic for you, and simplifying management of complex state like filters, hierarchical menus or federated search.
Easy to integrate
InstantSearch easily fits into existing code: It follows a strict separation of concerns, has few dependencies, and doesn’t make assumptions on how your app is built.
Components shipped in InstantSearch can easily be customised and configured, from high-level parameters to custom presentation logic. Most common search use-cases are covered with these components. Beyond those, writing your own component is as easy as implementing a single interface.
InstantSearch is a powerful tool for builders that want to stay in control.
Get started with InstantSearch iOS now.
How InstantSearch iOS works
InstantSearch iOS has been designed in such a way that you have full control of your UI.
Each component respects the single responsibility principle, as well as being extendible and customizable. This gives developers the control over all aspects of building a search experience; whether it’s related to the framework, the UI or any other use case.
Below is an overview of all components that you have access to:
Network requests and entities
Searcher takes care of the search requests to Algolia. It abstracts the complexity of the REST API, the retry logic, the sequencing and more.
This component takes care of keeping the state of the filters. Filters in a search experience are complex: you can have facets, numeric filters or tags. You can have conjunctive facets (AND), disjunctive facets (OR), or hierarchical facets. In short, there’s a lot of cases to handle, and the
FilterState makes it easy to define how you want your filters to be applied, in a declarative way.
This component helps you define any search API parameter that you want to add to your search requests.
Interactors contain the business logic of a specific search element or view, as well as the UI State of this specific element or view. Most of the time, you don’t need to write your own interactors: the ones of the InstantSearch SDK are enough.
These aren’t components in and of themselves, but most components have a
connect method. This lets them establish a connection with other components and lets them react to a change happening in the connected component.
Controller components play the role of an adapter to the UI element of a specific framework. For example, a
TextFieldController is an adapter for a
UITextField in iOS, and conforms to the
SearchBoxController protocol. The use of having such component is to make the library extendible: the same
Interactor can connect to any controller that implements a
SearchBoxController. In this way, if you have your own type of
textField, all you have to do is implement your own class that follows the
SearchBoxController protocol and connect it to the already defined
SearchBoxInteractor. There are many controllers available by default which you can find in the widget showcase.
Presenter component lets you control the output shown in search views. For example, when displaying a refinement list (list of filters), a
SelectableFacet is given to you which contains the title of the facet, the count associated to this facet, and whether it’s been selected or not by the user. Given this information, you are free to decide how to you want to display them in your UI.
View components are the Apple Native components. Whether they’re from UIKit, AppKit, or others, you can use them alongside the defined controllers to define any UI in your search experience.
Join the community
Ask questions and find answers on those following platforms.
- Write a feature request
- Use the Did you find this page helpful? form below
Stay up to date
- Look at the changelog.
All contributors are welcome, from casual to regular. Feel free to open a pull request.