Signature
Explore example code
Browse the Filter Numeric Comparison example code on GitHub.
About this widget
Filter Numeric Comparison is a view to filter on a numeric value using a comparison operator.Examples
Instantiate aFilterComparisonConnector and launch an initial search on its searcher.
Swift
Low-level API
If you want to fully control the Filter Numeric Comparison components and connect them manually, use the following components:Searcher. TheSearcherthat handles your searches.FilterState. The current state of the filters.NumberInteractor<T>. The logic applied to the numeric value.NumberController. The view controller that renders the numeric value.
Swift
SwiftUI
InstantSearch provides theNumberObservableController as a state model,
which is an implementation of the NumberController interface.
You need to connect NumberObservableController to the FilterComparisonConnector or NumberInteractor like any other NumberController implementation.
Swift
NumberObservableController as a data model.
It provides value and bounds properties to streamline the design process of your custom SwiftUI view.
Parameters
The Searcher that handles your searches
The
FilterState that holds filters.The attribute to filter on.
The comparison operator to apply.
The initial numeric value to filter on.
The optional bounds limiting the max and the min value of the number.
Whether the filter is added to a conjuncitve(
and) or a disjuncitve (or) group in the filter state.Filter group name in the filter state.
If not specified, the attribute value is used as the group name.
Controller
Controller interfacing with a concrete number view.
Swift