14-day free trial
Create a full-featured search experience in no time.
Sorry, there is no results for this query
We’re excited today to be releasing InstantSearch iOS, a library of views and helpers for building a great search experience on iOS. It is built on top of Algolia’s Swift API Client to give iOS developers a way to quickly build a search experience that will delight their users.
Before we dive into how InstantSearch iOS works, let’s talk about why we need this library in the first place.
Mobile screen sizes are small by nature, which makes it hard for end users to see and filter their results. It is therefore expected that developers invest a lot of their time into building a search experience. Let’s explore possible ways to implement search on iOS today, as well as their costs and benefits.
The most basic search experience that you can provide is by creating a local search on the data that you have on your device. This data can reside in one of the following places:
It is fairly straightforward to implement a basic string matching algorithm. Just follow a tutorial such as the Raywenderlich one, and you’ll get something working in an hour or so. They even add a way to filter by one refinement by scoping with a scope bar.
Another popular way of implementing search on mobile is to provide a search functionality from a backend. If you do it this way, the mobile app would request search results by simply making a network request to your backend and adding the query and the filters in the request.
This is the most complex way to implement your search since you have to take care of every part of your search architecture: the search business logic on the backend, the communication between the backend + iOS, and finally the presentation and update of your search UI experience.
The last way to implement a search experience is to rely on a 3rd party search-as-a-service to provide you search results and refinement capabilities. That way, the mobile app will just have to call an API over the network to get all the search results. This means speed superior to other solutions’, plus the search backend is taken care for you in this case.
All of the three methods above will help you build the search business logic of your app, but they have something missing: you still need to build the search UI on the iOS app. If you’ve tried to build a complex UI search experience, you quickly found out that it can be tough to get it right: from dealing with all the states of the search lifecycle to updating all components as results come or filters change, it can be quite a challenge to implement a search UI correctly.
InstantSearch iOS offers a way to easily build search UI experiences on iOS by using Algolia as the backend search-as-a-service. It lets the developer focus on the look and feel of their app, without having to worry about Algolia API calls, or query crafting and state management.
Search is very complex if you want it to be done in a correct way. A good search has to provide speed, relevance and typo tolerance, which is a lot to ask, especially to mobile developers whose primarily skill is building apps, not writing algorithms for fetching the most relevant search results.
Thinking in terms of terms such as disjunctive faceting offers a lot of cognitive complexity to the developer. InstantSearch makes it easy since developers will only have to think in terms of “and”, “or”, “<”, “==” instead of difficult concepts such as the difference between conjunctive and disjunctive faceting.
Dealing with the search state can be quite cumbersome. For example, how would you handle the state when requests come out of order? Also, you have to handle all parts of the search lifecycle, be it the initial default state, the no result state, or the new result/error state. Finally, you have to deal with all the data binding and keep all UI components in sync with the actual search state. InstantSearch iOS has been built to take care of all of that for you.
InstantSearch iOS provides you with numerous UI components called widgets, which are “search aware” components built on top of UIKit objects such as UITableView, UICollectionView and UISearchBar. These widgets follow search best practices on small mobile screens that will help the developer build great UX.
The nice thing about InstantSearch iOS is that it has many siblings such as InstantSearch Android, InstantSearch.js, and more. What this means for you is that you get to use one search engine with myriad possibilities, while having a uniform and consistent UX across all platforms.
As you use the library more and more, you might stumble upon a case where none of the provided widgets fit your needs. InstantSearch iOS has been built following Plug-in Architectures standards, which means that the library is modular, customizable and easily extensible.
The most important offering is the creation of custom widgets by implementing a few protocols on your UIView class. These protocols will provide you the relevant information that the widget needs, such as new search results coming by, or notifications of refinement changes happening in other widgets.
The Getting Started Guide will take you through the main steps to use the library. The library is open source and can be found in this repo. The example application is a great addition to the guide as it’ll help you get an idea of what you can build with InstantSearch iOS.
Team Lead Mobile/Native team