Page Summary
-
This documentation outlines available classes for digital ink recognition in Swift using ML Kit.
-
Key classes include
DigitalInkRecognizerfor performing recognition andDigitalInkRecognitionModelfor managing downloadable models. -
Input is represented by
Ink, composed ofStrokeobjects, while output is provided as aDigitalInkRecognitionResultwith multipleDigitalInkRecognitionCandidatealternatives. -
DigitalInkRecognitionContextcan 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
DigitalInkRecognitionResultfor more details.Declaration
Swift
class DigitalInkRecognitionCandidate : NSObject -
Information about the context in which an ink has been drawn.
Pass this object to a
DigitalInkRecognizeralongside 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
downloadmethod is called. The downloaded model is unzipped whenDigitalInkRecognizerloads 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
DigitalInkRecognitionContextfor 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
DigitalInkRecognizerto perform the recognition itself. If nothing could be recognized, the propertycandidateswill 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
Inkfor 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 -
Represents the user input as a collection of
Strokeand 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


