Skip to content

Search Controller

FUISearchController

open class FUISearchController: UISearchController, FUIBarcodeScanViewControllerDelegate

Fiori style UISearchController. The only difference between FUISearchController and regular UISearchController is the searchBar. FUISearchController's searchBar is FUISearchBar.

Developer can add a FUIBarcodeScanner to this FUISearchBar by setting the isBarcodeScannerEnabled property of the FUISearchBar to true. A barcode scanner icon will be displayed at the bookmark icon location of the search bar.

A barcode scanner view will be displayed when the barcode scanner icon is tapped.

For iOS 11, it is recommended to set the FUISearchController to navigationItem, instead of the table view header for iOS 10.

Here is a sample code snippet.

// Instantiate an FUISearchController and configure its properties
searchController = FUISearchController(searchResultsController: nil)
searchController.searchResultsUpdater = self
searchController.hidesNavigationBarDuringPresentation = true
searchController.searchBar.placeholderText = "Search The List"

// Adding barcode scanner to this search bar
searchController.searchBar.isBarcodeScannerEnabled = true
searchController.searchBar.barcodeScanner?.scanMode = .EAN_UPC
searchController.searchBar.barcodeScanner?.scanResultTransformer = { (scanString) -> String in
return scanString.uppercased()
}

if #available(iOS 11, *) {
navigationItem.searchController = searchController
navigationItem.hidesSearchBarWhenScrolling = false
} else {
tableView.tableHeaderView = searchController?.searchBar
}

Theming

fdlFUISearchController_searchBar {
bar-tint-color: @line;
background-color: @primary1_darkBackground;
background-tint-color: @tintColorDark;
}

Last update: December 8, 2020