VLDOCRViewControllerDelegate

Objective-C

@protocol VLDOCRViewControllerDelegate <NSObject>

Swift

protocol VLDOCRViewControllerDelegate : NSObjectProtocol

The VLDOCRViewControllerDelegate protocol provides callbacks for when the user has finished with the VLDOCRViewController.

  • The user pressed the cancel button.

    Declaration

    Objective-C

    - (void)ocrViewControllerDidCancel:
        (VLDOCRViewController *_Nonnull)viewController;

    Swift

    func ocrViewControllerDidCancel(_ viewController: VLDOCRViewController)

    Parameters

    viewController

    the instance of the view controller where the cancel occurred.

  • The user did not grant access to the camera so OCR can’t be performed.

    Declaration

    Objective-C

    - (void)ocrViewControllerWasDeniedCameraAuthorization:
        (VLDOCRViewController *_Nonnull)viewController;

    Swift

    func ocrViewControllerWasDeniedCameraAuthorization(_ viewController: VLDOCRViewController)

    Parameters

    viewController

    the instance of the view controller where the action occurred.

  • The OCR reading was successful.

    Declaration

    Objective-C

    - (void)ocrViewController:(VLDOCRViewController *_Nonnull)viewController
           didCompleteReading:(VLDRecord *_Nullable)record
                        image:(UIImage *_Nullable)image
                     metadata:(NSDictionary *_Nullable)metadata;

    Swift

    func ocrViewController(_ viewController: VLDOCRViewController, didCompleteReading record: VLDRecord?, image: UIImage?, metadata: [AnyHashable : Any]?)

    Parameters

    viewController

    the VLDOCRViewController that got the reading, passed back to simplify dismissal.

    record

    the reading that was just taken.

    image

    the final image of the screen used to determine the reading.

    metadata

    A dictionary containing additional metadata from the OCR process. The dictionary should contain the final full screen camera preview processed by the OCR engine, identified with the key kVLDOCRMetadataFinalPreviewKey. The dictionary will also contain the frame of the image inside the camera preview identified by the key kVLDOCRMetadataImageFrameKey. The coordinate space of this frame will be the screen’s coordinate space.