Search Bar and Barcode Scan

  • Fiori style UISearchBar.

    Developer can add a FUISearchBarcodeScanner 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.

    Please refer to FUISearchController about how to use this FUISearchBar.

    See more

    Declaration

    Swift

    public class FUISearchBar: UISearchBar
  • Fiori style UISearchController. The only difference between FUISearchController and regular UISearchController is the searchBar. FUISearchController’s searchBar is FUISearchBar.

    Developer can add a FUISearchBarcodeScanner 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.

    Here is an sample code for an UITableViewController to add the FUISearchBar to its table view header.

       // 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()
       }
    
       self.tableView.tableHeaderView = searchController.searchBar
    
    
    
    See more

    Declaration

    Swift

    open class FUISearchController: UISearchController, FUIBarcodeScannerDelegate
  • Protocol to interact with a Barcode Scanner. The Scanner protocol provides methods to start an user interface that automatically scans for 1D and 2D codes. To find them and therefore retrieve the scanned result it uses the device’s camera.

    You retrieve a Scanner instance through ScannerFactory().createScanner(ScanMode) or ScannerFactory().createScanner(Set<String>).

    The Scanner’s scanCode(UIViewController) method is called from an UIViewController to start the UI for scanning a code.

    The ScannerDelegate is used to retrieve the respective ScanResult. You have to register yourself on this delegate and also implement the delegate protocol in order to retrieve and process the ScanResult.

    The following example depicts the intended Scanner API usage:

    // In your UIViewController, when a button is clicked
    // you add the Scanner UI to your UIView container:
    
    @IBAction func buttonPressed(sender: AnyObject) {
        scanner?.scanCode(uiView)
    }
    
    // Implement the didReceiveScanResult of the ScannerDelegate Protocol.
    
    func didReceiveScanResult(scanResult: ScanResult?){
        guard let result = scanResult else {
        // if the result is nil you can handle this here.
        return
        }
        // do something useful with the scan result.
    }
    
    See more

    Declaration

    Swift

    public protocol FUIBarcodeScanner: FUISearchBarcodeScanner
  • Delegate protocol for receiving the result of a code scanning process.

    See more

    Declaration

    Swift

    public protocol FUIBarcodeScannerDelegate: class
  • The ScanMode enum defines a set of predefined modes to scan codes with the Scanner. Each mode contains a set of different codes including 1D and 2D codes.

    See more

    Declaration

    Swift

    public enum FUIBarcodeScanMode
  • Represents the decoded result of a code scanning operation.

    See more

    Declaration

    Swift

    public struct FUIBarcodeScanResult
  • Enum which covers all errors occurring in the barcode scanner framework.

    See more

    Declaration

    Swift

    public enum FUIBarcodeScannerError: Error, Equatable