SBSDKBarcodeScannerViewControllerDelegate
@protocol SBSDKBarcodeScannerViewControllerDelegate <NSObject>
A delegate protocol to customize the behavior, look and feel of the SBSDKBarcodeScannerViewControllerDelegate.
-
Asks the delegate if the receiver should detect barcodes on the next video frame. Optional.
Declaration
Objective-C
- (BOOL)barcodeScannerControllerShouldDetectBarcodes: (nonnull SBSDKBarcodeScannerViewController *)controller;
Swift
optional func barcodeScannerControllerShouldDetectBarcodes(_ controller: SBSDKBarcodeScannerViewController) -> Bool
Parameters
controller
The calling SBSDKBarcodeScannerViewController.
Return Value
YES, if barcodes should be detected on the next video frame. No otherwise.
-
Asks the delegate to filter the detected barcodes. Optional.
Declaration
Objective-C
- (nonnull NSArray<SBSDKBarcodeScannerResult *> *) barcodeScanner:(nonnull SBSDKBarcodeScannerViewController *)controller filterResults:(nonnull NSArray<SBSDKBarcodeScannerResult *> *)codes;
Swift
optional func barcodeScanner(_ controller: SBSDKBarcodeScannerViewController, filterResults codes: [SBSDKBarcodeScannerResult]) -> [SBSDKBarcodeScannerResult]
Parameters
controller
The calling SBSDKBarcodeScannerViewController.
codes
Array of SBSDKBarcodeScannerResult containing the detected barcodes.
Return Value
The filtered array of barcodes to be delivered to the post-processing.
-
Asks the delegate whether to highlight a barcode on the selection overlay or not. Only called only when the selection overlay is enabled.
Declaration
Objective-C
- (BOOL)barcodeScanner:(nonnull SBSDKBarcodeScannerViewController *)controller shouldHighlightResult:(nonnull SBSDKBarcodeScannerResult *)code;
Swift
optional func barcodeScanner(_ controller: SBSDKBarcodeScannerViewController, shouldHighlight code: SBSDKBarcodeScannerResult) -> Bool
Parameters
controller
The calling SBSDKBarcodeScannerViewController.
code
The barcode scanner result that may be highlighted or not.
Return Value
YES, if the provided barcode result should be highlighted on the selection overlay. NO otherwise.
-
Asks the delegate for the string to be displayed for the given barcode result on the selection overlay. Only called only when the selection overlay is enabled.
Declaration
Objective-C
- (nullable NSString *)barcodeScanner: (nonnull SBSDKBarcodeScannerViewController *) controller selectionOverlayTextFor:(nonnull SBSDKBarcodeScannerResult *)code;
Swift
optional func barcodeScanner(_ controller: SBSDKBarcodeScannerViewController, selectionOverlayTextFor code: SBSDKBarcodeScannerResult) -> String?
Parameters
controller
The calling SBSDKBarcodeScannerViewController.
code
The barcode scanner result the returned text will be displayed for.
Return Value
A string to be displayed on the selection overlay for the given barcode result. Return an empty, non-nil string of you want to display no text. If you return nil, the text is automatically generated from the selectionOverlayTextFormat property. Otherwise the setting of the selectionOverlayTextFormat property is ignored.
-
Informs the delegate that the receiver has detected some barcodes. Optional.
Declaration
Objective-C
- (void)barcodeScannerController: (nonnull SBSDKBarcodeScannerViewController *)controller didDetectBarcodes: (nonnull NSArray<SBSDKBarcodeScannerResult *> *)codes onImage:(nonnull UIImage *)image;
Swift
optional func barcodeScannerController(_ controller: SBSDKBarcodeScannerViewController, didDetectBarcodes codes: [SBSDKBarcodeScannerResult], on image: UIImage)
Parameters
controller
The calling SBSDKBarcodeScannerViewController.
codes
Array of SBSDKBarcodeScannerResult containing the detected barcodes.
image
The image the barcodes have been detected on. The image is cropped to the visible area on the screen and to the view finder rectangle, if a view finder is enabled.
-
Returns captured barcode image. Will fire only if
barcodeImageGenerationType
parameter is notSBSDKBarcodeImageGenerationTypeNone
. Optional.Declaration
Objective-C
- (void)barcodeScannerController: (nonnull SBSDKBarcodeScannerViewController *)controller didCaptureBarcodeImage:(nonnull UIImage *)barcodeImage;
Swift
optional func barcodeScannerController(_ controller: SBSDKBarcodeScannerViewController, didCaptureBarcodeImage barcodeImage: UIImage)
Parameters
controller
The calling SBSDKBarcodeScannerViewController.
barcodeImage
A captured device-orientation-corrected barcode image.