MBRecognizerRunnerViewController

@protocol MBRecognizerRunnerViewController <NSObject>

Protocol for View controllers which present camera and provide scanning features

  • MBRecognizerRunnerViewController’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, assign, unsafe_unretained, readwrite) BOOL autorotate;

    Swift

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

    Default: UIInterfaceOrientationMaskPortrait.

    Declaration

    Objective-C

    @property (nonatomic, assign, unsafe_unretained, readwrite)
        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 background 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(_ completion: (() -> Void)? = nil)

    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 MBOverlaySettings.

    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

    Declaration

    Objective-C

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

    Swift

    func captureHighResImage(_ highResoulutionImageCaptured: @escaping MBCaptureHighResImage)