---
title: PKStrokeRecognizer
framework: pencilkit
role: symbol
role_heading: Class
path: pencilkit/pkstrokerecognizer
---

# PKStrokeRecognizer

An actor that recognizes handwriting and searches for text within a PencilKit drawing.

## Declaration

```swift
final actor PKStrokeRecognizer
```

## Mentioned in

Recognizing handwriting and converting it to text

## Overview

Overview Use PKStrokeRecognizer to extract recognized text from individual strokes, generate content suitable for indexing in search systems such as Spotlight, and search for specific words or phrases within handwritten content. The recognizer uses an on-device recognition engine and all operations are asynchronous. Recognition works best when handwriting is scaled as if drawn on standard US Letter or A4 paper in points. Before creating a recognizer, check supportedLanguages to confirm your target language is available. If you persist results from a recognizer, store the current recognitionVersion alongside the results and regenerate them when the version advances.

## Topics

### Creating a recognizer

- [init(preferredLanguages:)](pencilkit/pkstrokerecognizer/init(preferredlanguages:).md)

### Providing drawing content

- [drawing](pencilkit/pkstrokerecognizer/drawing.md)
- [updateDrawing(_:)](pencilkit/pkstrokerecognizer/updatedrawing(_:).md)

### Recognizing handwriting

- [recognizedText(strokeIDs:)](pencilkit/pkstrokerecognizer/recognizedtext(strokeids:).md)
- [indexableContent](pencilkit/pkstrokerecognizer/indexablecontent.md)

### Searching for text

- [search(_:fullWordsOnly:caseMatchingOnly:)](pencilkit/pkstrokerecognizer/search(_:fullwordsonly:casematchingonly:).md)
- [PKStrokeRecognizer.SearchResult](pencilkit/pkstrokerecognizer/searchresult.md)

### Checking language support

- [supportedLanguages](pencilkit/pkstrokerecognizer/supportedlanguages.md)
- [languages](pencilkit/pkstrokerecognizer/languages.md)
- [recognitionVersion](pencilkit/pkstrokerecognizer/recognitionversion.md)

## Relationships

### Conforms To

- [Actor](swift/actor.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Handwriting recognition

- [Building a handwriting recognition experience with PencilKit](pencilkit/building-a-handwriting-recognition-experience-with-pencilkit.md)
- [Recognizing handwriting and converting it to text](pencilkit/recognizing-handwriting-and-converting-to-text.md)
