Guides / Building Search UI / UI & UX patterns

Sorting refinements in InstantSearch iOS

As of May 1st, 2024, Apple requires all iOS apps to include a privacy manifest. Ensure you incorporate our provided privacy manifest files into your documentation. For more details, see Privacy Manifest.

Sorting Refinements

With InstantSearch, we make it easy for you to customize the order of your refinement lists. You can sort them in two ways, alphabetically or by occurrence (by refinement count), in ascending or descending order.

Example

Using our RefinementList widgets (RefinementTableWidget or RefinementCollectionWidget), you can specify how it is sorted with the sortBy property like so:

1
2
3
4
5
6
7
8
9
refinementTableWidget.sortBy = "count:asc"
refinementTableWidget.sortBy = "count:desc"
refinementTableWidget.sortBy = "name:asc"
refinementTableWidget.sortBy = "name:desc"

refinementCollectionWidget.sortBy = "count:asc"
refinementCollectionWidget.sortBy = "count:desc"
refinementCollectionWidget.sortBy = "name:asc"
refinementCollectionWidget.sortBy = "name:desc"