Middleware

Last Updated - Platform 18.1 - SDK 13.0

Middleware handle interaction across features or services.

Apply filters

.withDelegateMiddleware(using: store.dispatch)
.withDelegateMiddleware(.applySelection(dispatchToPrevious: store.dispatch))

Middleware to delegate (pass back) the new Filter selection to the previous feature. This delegate middleware pattern is used by all selection features.

This middleware must be added to the builder when building this feature.

Handles the following actions:

FilterSelectionStateAction.applySelection: This action dispatches a FilterSelectionAction with state.selected to the dispatch function injected into the builder (usually the previous feature's store.dispatch). The dispatch function acts as a delegate so this means the apply action and data is sent to the previous feature.

.withRouterMiddleware(.filterSelectionNavigation(navigator: Container.shared.navigator()))

Middleware to handle navigation actions.

Handles the following NavigationAction destinations:

FilterSelectionNavigationDestination.filterOptionSelection: Builds and presents the SelectionViewController using the SelectionBuilder to present selection of FilterOption items. Uses delegate middleware to map the resulting apply selection into a FilterSelectionStateAction.update action.

Currently the Filter Option Selection feature is built by this middleware. To customise it you must also customise this middleware and override this action.