SBSDKBarcodeScannerViewControllerDelegate
@protocol SBSDKBarcodeScannerViewControllerDelegate <NSObject>
A delegate protocol to customize the behavior, look and feel of the SBSDKBarcodeScannerViewControllerDelegate.
-
Informs the delegate that the receiver has detected some barcodes. If the receivers selectionOverlayEnabled property is set to YES and its automaticSelectionEnabled property is set to NO, this method is not called unless the user taps on a barcode in the selection overlay.
Declaration
Objective-C
- (void)barcodeScannerController: (nonnull SBSDKBarcodeScannerViewController *)controller didDetectBarcodes: (nonnull NSArray<SBSDKBarcodeScannerResult *> *)codes;
Swift
func barcodeScannerController(_ controller: SBSDKBarcodeScannerViewController, didDetectBarcodes codes: [SBSDKBarcodeScannerResult])
Parameters
controller
The calling SBSDKBarcodeScannerViewController.
codes
Array of SBSDKBarcodeScannerResult containing the detected barcodes.
-
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 *> *) barcodeScannerController: (nonnull SBSDKBarcodeScannerViewController *)controller filterResults: (nonnull NSArray<SBSDKBarcodeScannerResult *> *)codes;
Swift
optional func barcodeScannerController(_ 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. Called only if the receivers selectionOverlayEnabled property is set to YES and custom-cell mode is disabled.
Declaration
Objective-C
- (BOOL)barcodeScannerController: (nonnull SBSDKBarcodeScannerViewController *)controller shouldHighlightResult:(nonnull SBSDKBarcodeScannerResult *)code;
Swift
optional func barcodeScannerController(_ 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. Called only if the receivers selectionOverlayEnabled property is set to YES and custom-cell mode is disabled.
Declaration
Objective-C
- (nullable NSString *) barcodeScannerController: (nonnull SBSDKBarcodeScannerViewController *)controller selectionOverlayTextFor:(nonnull SBSDKBarcodeScannerResult *)code;
Swift
optional func barcodeScannerController(_ 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 a barcode has been tapped on the barcode selection overlay. Optional. Called only if the receivers selectionOverlayEnabled property is set to YES and its automaticSelectionEnabled property is set to NO.
Declaration
Objective-C
- (void)barcodeScannerController: (nonnull SBSDKBarcodeScannerViewController *)controller didTapOnBarcode:(nonnull SBSDKBarcodeScannerResult *)code;
Swift
optional func barcodeScannerController(_ controller: SBSDKBarcodeScannerViewController, didTapOnBarcode code: SBSDKBarcodeScannerResult)
Parameters
controller
The calling SBSDKBarcodeScannerViewController.
code
The SBSDKBarcodeScannerResult the user has tapped on.
-
Informs the delegate that the receiver has updated the detected barcodes. Called only if the receivers selectionOverlayEnabled property is set to YES and its automaticSelectionEnabled property is set to NO.
Declaration
Objective-C
- (void)barcodeScannerController: (nonnull SBSDKBarcodeScannerViewController *)controller didUpdateDetectedBarcodes: (nonnull NSArray<SBSDKBarcodeScannerResult *> *)codes;
Swift
optional func barcodeScannerController(_ controller: SBSDKBarcodeScannerViewController, didUpdateDetectedBarcodes codes: [SBSDKBarcodeScannerResult])
Parameters
controller
The calling SBSDKBarcodeScannerViewController.
codes
Array of SBSDKBarcodeScannerResult containing the currently detected barcodes.
-
Asks the delegate to configure your custom cell for a barcode. Only called in custom-cell mode. Called only if the receivers selectionOverlayEnabled property is set to YES and custom-cell mode is enabled. Must be implemented if custom-cell mode is enabled!
Declaration
Objective-C
- (void)barcodeScannerController: (nonnull SBSDKBarcodeScannerViewController *)controller configureCustomCell:(nonnull UICollectionViewCell *)cell forBarcode:(nonnull SBSDKBarcodeScannerResult *)code withBarcodePolygonPath:(nonnull UIBezierPath *)path;
Swift
optional func barcodeScannerController(_ controller: SBSDKBarcodeScannerViewController, configureCustomCell cell: UICollectionViewCell, forBarcode code: SBSDKBarcodeScannerResult, withBarcodePolygonPath path: UIBezierPath)
Parameters
controller
The calling SBSDKBarcodeScannerViewController.
cell
The UICollectionViewCell to be configured with the barcode. Must be casted to your custom cells class.
code
The barcode scanner result that should be represented by the cell.
path
The UIBezierPath of the actual barcodes outline in the view space of the cell with an unmodified frame.
-
Asks the delegate to modify the frame of a custom cell. Called only if the receivers selectionOverlayEnabled property is set to YES and custom-cell mode is enabled.
Declaration
Objective-C
- (CGRect)barcodeScannerController: (nonnull SBSDKBarcodeScannerViewController *)controller customCellFrameForProposedFrame:(CGRect)frame;
Swift
optional func barcodeScannerController(_ controller: SBSDKBarcodeScannerViewController, customCellFrameForProposedFrame frame: CGRect) -> CGRect
Parameters
controller
The calling SBSDKBarcodeScannerViewController.
frame
The proposed frame of a custom selection overlay cell in view space.
Return Value
The final frame of the cell.