Text Capture Listener#

Defined in framework ScanditTextCapture

SDCTextCaptureListener#
@protocol SDCTextCaptureListener <NSObject>

Added in version 6.1.0

Delegate protocol for traditional text capture.

- didStartObservingTextCapture:#
- (void)didStartObservingTextCapture:(SDCTextCapture *)textCapture

Added in version 6.1.0

Called when the listener starts observing the text capture instance.

- didStopObservingTextCapture:#
- (void)didStopObservingTextCapture:(SDCTextCapture *)textCapture

Added in version 6.1.0

Called when the listener stops observing the text capture instance.

- textCapture:didCaptureInSession:frameData:#
- (void)textCapture:(SDCTextCapture *)textCapture
didCaptureInSession:(SDCTextCaptureSession *)session
          frameData:(id<SDCFrameData>)frameData

Added in version 6.1.0

Invoked whenever at least one text has been captured. The newly captured texts can be retrieved from SDCTextCaptureSession.newlyCapturedTexts.

This method is invoked from a recognition internal thread. To perform UI work, you must dispatch to the main thread first.

Inside this method, you will typically want to start processing the captured texts somehow, e.g. by validating the text captured. Depending on the application, you will want to pause, or stop recognition, or continue reading texts:

  • To pause the capture session, but keep the camera (frame source) running, just set the text capture‚Äôs enabled property to NO.

    captureMode.isEnabled = true
    
  • To stop the capture session, you will need to both disable the capture mode and stop the frame source. While it is possible to only stop the camera and keep the capture mode enabled, this may lead to additional capture events being delivered, which is typically not desired. The following lines of code show how to disable the capture mode and stop the frame source as well:

    // no more didCapture callbacks will be invoked after this call.
    captureMode.isEnabled = false
    // asynchronously turn off the camera as quickly as possible.
    captureMode.context?.frameSource?.switch(toDesiredState: .off, completionHandler: nil)