MLKitTextRecognitionCommon Framework Reference

  • MLKTextElement represents a word or space-separated text segment recognized within an image.

  • It provides access to the text content, its bounding rectangle (frame), and recognized languages.

  • Corner points of the element's location in the image are also available, along with a string representation of the recognized text.

  • Direct initialization of MLKTextElement is not allowed; it's obtained through text recognition results.

TextElement

class TextElement : NSObject

A text element recognized in an image. A text element is a space-separated segment in a text line (for example, a word in most Latin-script languages).

  • String representation of the text element that was recognized.

    Declaration

    Swift

    var text: String { get }
  • The rectangle that contains the text element relative to the image in the default coordinate space.

    Declaration

    Swift

    var frame: CGRect { get }
  • An array of recognized languages in the text element. If no languages were recognized, the array is empty.

    Declaration

    Swift

    var recognizedLanguages: [MLKTextRecognizedLanguage] { get }
  • The four corner points of the text element in clockwise order starting with the top left point relative to the image in the default coordinate space. The NSValue objects are CGPoints.

    Declaration

    Swift

    var cornerPoints: [NSValue] { get }
  • Unavailable.