BarcodeReader

Objective-C

@interface BarcodeReader : NSObject

Swift

class BarcodeReader : NSObject

A utility class to read barcodes via camera

  • A PreviewView class to show the bar code reader camera

    Declaration

    Objective-C

    @property (weak, nonatomic) PreviewView* previewView
  • To intialise the barcode reader with preview view and delegate

    Declaration

    Objective-C

    - (nonnull instancetype)initWithPreview:(id)previewView
                         endSessionDelegate:(nonnull id)sessionDelegate;

    Swift

    init(preview previewView: Any!, endSessionDelegate sessionDelegate: Any)

    Parameters

    previewView

    a PreviewView to show camera frames

    sessionDelegate

    an object which conforms to BarcodeReaderDelegate

  • To start the barcode reader scan

    Declaration

    Objective-C

    - (void)start;

    Swift

    func start()
  • To stop the barcode reader scan

    Declaration

    Objective-C

    - (void)stop;

    Swift

    func stop()
  • To reset the status of the barcode scanner

    Declaration

    Objective-C

    - (void)reset;

    Swift

    func reset()
  • To release the barcode scanner and it’s reader status

    Declaration

    Objective-C

    - (void)release_;

    Swift

    func release_()
  • To stop the frame processing for the barcode reader

    Declaration

    Objective-C

    - (void)stopProcessing;

    Swift

    func stopProcessing()
  • To restart the frame processing for the barcode reader

    Declaration

    Objective-C

    - (void)restartProcessing;

    Swift

    func restartProcessing()
  • To control the status of the flash light

    Declaration

    Objective-C

    - (BOOL)turnTorchOnOff:(BOOL)onOff;

    Swift

    func turnTorch(onOff: Bool) -> Bool

    Parameters

    onOff

    a boolean to control the flash light turning on or off