DMSDetectorViewControllerDelegate

@protocol DMSDetectorViewControllerDelegate <NSObject>

Delegate protocol for returning results from a DMSDetectorViewController. Delegates can implement this protocol to either respond to a new result or a cancel result from a DMSDetectorViewController. Implementors are responsible for dismissing a DMSDetectorViewController as a modal view controller themselves, so the detectorViewControllerDidCancel: delegate method should be used to dismiss the view controller.

  • Delegate method for deciding if payloads from a result should be resolved. Passes a reader result that contains the found payloads and other metadata about the detection. Returned payloads will be resolved. If this delegate method is not implemented, the detector view controller will default to resolving the first payload returned by the reader result.

    Declaration

    Objective-C

    - (nullable NSArray<DMSPayload *> *)
                detectorViewController:
                    (nonnull DMSDetectorViewController *)viewController
        shouldResolvePayloadsForResult:(nonnull DMSReaderResult *)result;

    Swift

    optional func detectorViewController(_ viewController: DetectorViewController, shouldResolvePayloadsFor result: ReaderResult) -> [Payload]?
  • Called if the view controller finds content. Responder is responsible for dismissing view controller if necessary.

    Declaration

    Objective-C

    - (void)detectorViewController:
                (nonnull DMSDetectorViewController *)viewController
                   resolvedContent:(nonnull DMSResolvedContent *)resolvedContent
                        forPayload:(nonnull DMSPayload *)payload;

    Swift

    optional func detectorViewController(_ viewController: DetectorViewController, resolvedContent: ResolvedContent, for payload: Payload)
  • Called if the view controller is presented as a modal and it is cancelled. View controller will dismiss itself.

    Declaration

    Objective-C

    - (void)detectorViewControllerDidCancel:
        (nonnull DMSDetectorViewController *)viewController;

    Swift

    optional func detectorViewControllerDidCancel(_ viewController: DetectorViewController)
  • Called if the view controller encounters an error in the Resolver callback or if AV Foundation sent a AVCaptureSessionRuntimeErrorNotification error (session capture error).

    Declaration

    Objective-C

    - (void)detectorViewController:
                (nonnull DMSDetectorViewController *)viewController
                   didReceiveError:(nonnull NSError *)error;

    Swift

    optional func detectorViewController(_ viewController: DetectorViewController, didReceiveError error: Error)