MLKitDigitalInkRecognition Framework Reference

  • This documentation outlines available classes for digital ink recognition in Swift using ML Kit.

  • Key classes include DigitalInkRecognizer for performing recognition and DigitalInkRecognitionModel for managing downloadable models.

  • Input is represented by Ink , composed of Stroke objects, while output is provided as a DigitalInkRecognitionResult with multiple DigitalInkRecognitionCandidate alternatives.

  • DigitalInkRecognitionContext can be used to improve recognition quality by providing information about the drawing context.

  • Developers can utilize these classes to build handwriting recognition features in their applications.

Classes

The following classes are available globally.

  • Individual recognition candidate.

    A recognizer usually provides several recognition alternatives. This object represents one such alternative.

    See DigitalInkRecognitionResult for more details.

    Declaration

    Swift

      class 
     DigitalInkRecognitionCandidate 
     : 
     NSObject 
     
    
  • Information about the context in which an ink has been drawn.

    Pass this object to a DigitalInkRecognizer alongside an ink to improve the recognition quality.

    Declaration

    Swift

      class 
     DigitalInkRecognitionContext 
     : 
     NSObject 
     
    
  • Represents a downloadable recognition model.

    Recognition models are downloaded on the device when the download method is called. The downloaded model is unzipped when DigitalInkRecognizer loads it at inference time for the first time, which makes the first recognition a bit slower than subsequent ones.

    This object contains properties that are constant throughout the lifetime of a recognition model.

    See DigitalInkRecognitionContext for the properties that depend on the ink being recognized.

    Declaration

    Swift

      class 
     DigitalInkRecognitionModel 
     : 
      RemoteModel 
     
     
    
  • Represents a digital ink recognition model specific to a language, script, and optionally a regional variant.

    Declaration

    Swift

      class 
     DigitalInkRecognitionModelIdentifier 
     : 
     NSObject 
     
    
  • Object representing the output of an ink recognition.

    A recognizer usually provides several recognition alternatives, because the user intent is not always clear. For example, if the user writes a vertical line and then a circle, the recognition alternatives could include “10”, “IO”, and “lo”.

    Alternatives are named “candidates”. This object represents a set of candidates as a list of DigitalInkRecognitionCandidate .

    Use DigitalInkRecognizer to perform the recognition itself. If nothing could be recognized, the property candidates will be an empty array.

    Declaration

    Swift

      class 
     DigitalInkRecognitionResult 
     : 
     NSObject 
     
    
  • Object to perform handwriting recognition on digital ink.

    Digital ink is the vector representation of what a user has written. It is composed of a sequence of strokes, each being a sequence of touch points (coordinates and timestamp). See Ink for details.

    Declaration

    Swift

      class 
     DigitalInkRecognizer 
     : 
     NSObject 
     
    
  • Options defining the behavior of a DigitalInkRecognizer .

    Declaration

    Swift

      class 
     DigitalInkRecognizerOptions 
     : 
     NSObject 
     
    
  • A single touch point from the user.

    Declaration

    Swift

      class 
     StrokePoint 
     : 
     NSObject 
     
    
  • Represents a sequence of touch points between a pen (resp. touch) down and pen (resp. touch) up event.

    Declaration

    Swift

      class 
     Stroke 
     : 
     NSObject 
     
    
  • Ink

    Represents the user input as a collection of Stroke and serves as input for the handwriting recognition task.

    Declaration

    Swift

      class 
     Ink 
     : 
     NSObject 
     
    
  • A model that is stored remotely on the server and downloaded to the device.

    Declaration

    Swift

      class 
     RemoteModel 
     : 
     NSObject 
     
    
  • Properties of the writing area.

    The writing area is the area on the screen where the user can draw an ink.

    Declaration

    Swift

      class 
     WritingArea 
     : 
     NSObject 
     
    
Design a Mobile Site
View Site in Mobile | Classic
Share by: