MLKitTextRecognition Framework Reference

TextRecognizer

class TextRecognizer : NSObject

A text recognizer that recognizes text in an image.

  • Returns a text recognizer.

    Declaration

    Swift

    class func textRecognizer() -> Self

    Return Value

    A text recognizer.

  • Unavailable. Use the class method.

  • Processes the given image for text recognition.

    Declaration

    Swift

    func process(_ image: MLKVisionImage, completion: @escaping TextRecognitionCallback)

    Parameters

    image

    The image to process.

    completion

    Handler to call back on the main queue when text recognition completes.

  • Returns text results in the given image or nil if there was an error. The text recognition is performed synchronously on the calling thread.

    It is advised to call this method off the main thread to avoid blocking the UI. As a result, an NSException is raised if this method is called on the main thread.

    Declaration

    Swift

    func results(in image: MLKVisionImage) throws -> MLKText

    Parameters

    image

    The image to get results in.

    error

    An optional error parameter populated when there is an error getting results.

    Return Value

    Text results in the given image or nil if there was an error.