MBCRecognizerRunnerViewController

Objective-C

@protocol MBCRecognizerRunnerViewController <NSObject>

Swift

protocol MBCRecognizerRunnerViewController : NSObjectProtocol

Protocol for View controllers which present camera and provide scanning features

  • MBCRecognizerRunnerViewController’s shouldAutorotate will return this value.

    Default: NO.

    Set it to YES if you want scanning view controller to autorotate.

    Declaration

    Objective-C

    @property (nonatomic) BOOL autorotate;

    Swift

    var autorotate: Bool { get set }
  • MBCRecognizerRunnerViewController’s supportedInterfaceOrientations will return this value.

    Default: UIInterfaceOrientationMaskPortrait.

    Declaration

    Objective-C

    @property (nonatomic) UIInterfaceOrientationMask supportedOrientations;

    Swift

    var supportedOrientations: UIInterfaceOrientationMask { get set }
  • Pause scanning without dismissing the camera view.

    If there is camera frame being processed at a time, the processing will finish, but the results of processing will not be returned.

    NOTE: This method must be called from the background thread

    Declaration

    Objective-C

    - (void)pauseScanning;

    Swift

    func pauseScanning()
  • Retrieve the current state of scanning.

    NOTE: This method is always returned on the background thread.

    Declaration

    Objective-C

    - (BOOL)isScanningPaused;

    Swift

    func isScanningPaused() -> Bool

    Return Value

    YES if scanning is paused. NO if it’s in progress

  • Resumes scanning. Optionally, internal state of recognizers can be reset in the process.

    If you continue scanning the same object, for example, the same slip, or the same MRTD document, to get result with higher confidence, then pass NO to reset State.

    If you move to scan another object, for example, another barcode, or another payment slip, then pass YES to reset State.

    Internal state is used to use the fact that the same object exists on multiple consecutive frames, and using internal state provides better scanning results.

    NOTE: This method must be called on the main thread.

    Declaration

    Objective-C

    - (void)resumeScanningAndResetState:(BOOL)resetState;

    Swift

    func resumeScanningAndResetState(_ resetState: Bool)

    Parameters

    resetState

    YES if state should be reset.

  • Resumes camera session asynchronously on camera queue. This method is automatically called in viewWillAppear when ScanningViewController enters screen.

    Declaration

    Objective-C

    - (void)resumeCamera:(void (^_Nullable)(void))completion;

    Swift

    func resumeCamera() async

    Parameters

    completion

    block is executed on main queue after camera is resummed

  • Pauses camera session. This method is automatically called in viewDidDissapear when ScanningViewController exits screen.

    Declaration

    Objective-C

    - (BOOL)pauseCamera;

    Swift

    func pauseCamera() -> Bool
  • Retrieve the current state of camera.

    Declaration

    Objective-C

    - (BOOL)isCameraPaused;

    Swift

    func isCameraPaused() -> Bool

    Return Value

    YES if camera is paused. NO if camera is active

  • Play scan sound.

    It uses default scan sound, you can change it by setting your own soundFilePath in MBCOverlaySettings.

    Declaration

    Objective-C

    - (void)playScanSuccessSound;

    Swift

    func playScanSuccessSound()
  • Call to turn on torch without camera overlay

    Declaration

    Objective-C

    - (void)willSetTorchOn:(BOOL)torchOn;

    Swift

    func willSetTorch(on torchOn: Bool)
  • Settings recofiguration

    NOTE: This method must be called on the background thread.

    Declaration

    Objective-C

    - (void)resetState;

    Swift

    func resetState()
  • Method with block for getting high resoultion images

    Warning

    this is returned from background thread @discussion The high res image is captured independently of other images returned by recognizers. Because of a delay when switching from video to photo camera mode, the high-resolution image can look different from other images like cropped images.

    Declaration

    Objective-C

    - (void)captureHighResImage:
        (nonnull MBCCaptureHighResImage)highResoulutionImageCaptured;

    Swift

    func captureHighResImage(_ highResoulutionImageCaptured: @escaping MBCCaptureHighResImage)