Skip to main content
Signature

Explore example code

Browse the example code on GitHub.

About this widget

Requirements

Declare each facet attribute in attributesForFaceting. Use the Algolia dashboard or the API. Configure the facet order with renderingContent.facetOrdering. Add each facet attribute to the query’s facets property with Searcher.request.query.facets.
Dynamic facet list requires InstantSearch iOS v7.12.0 or later.

Example

Create a DynamicFacetListConnector, set the query’s facets, and run the initial search.
Swift

Parameters

Searcher
required
The Searcher that runs searches.
FilterState
required
The FilterState that stores the current filters.
[AttributedFacets]
default: []
The initial ordered facets.
[Attribute: Set<String>]
default: []
Maps each facet attribute to its selected facet values.
[Attribute: SelectionMode]
default: [:]
Maps each facet attribute to its facet-value selection mode. The default mode is .single.
[Attribute: FilterGroupDescriptor]
default: [:]
Maps each facet attribute to the filter group that stores its filters in the filter state.
DynamicFacetListController
The controller that displays the ordered facets and handles selections.

Low-level API

Use the following components to connect the dynamic facet list:
  • Searcher: runs searches.
  • FilterState: stores the current filter state.
  • DynamicFacetListInteractor: manages dynamic facet state and behavior.
  • DynamicFacetListController: displays the ordered facets and handles user interactions.
Swift

Customize the view

Use a built-in controller or use DynamicFacetListController to customize how the dynamic facet list appears and handles user interactions.

UIKit

DynamicFacetListTableViewController is a built-in UITableViewController that conforms to the DynamicFacetListController protocol. To use a UICollectionView, a third-party view, or custom behavior, create a controller that conforms to DynamicFacetListController.

DynamicFacetListController protocol

SwiftUI

DynamicFacetListObservableController conforms to DynamicFacetListController for SwiftUI. Use its orderedFacets and selections properties and its toggle and isSelected methods to build a custom SwiftUI view.

Build a SwiftUI view

Swift
Last modified on July 30, 2026