iOS 27 adds PKStrokeRecognizer to PencilKit, enabling on-device handwriting recognition across 29 languages, plus Bézier path conversion, stable stroke identity, selection access, and programmatic stroke slicing APIs.
• PKStrokeRecognizer runs fully on-device with no network required, letting any app search, index, or validate handwritten content without a privacy compromise
• Path conversion between PKStrokePath and Bézier paths means you can retrofit handwriting recognition onto existing custom canvas implementations — not just PKCanvasView
• Stable stroke UUIDs and programmatic erasing/substroke extraction unlock custom undo stacks, stroke-order animations, and interactive highlight features that were previously impossible
A SwiftUI view that lets the user draw on a PKCanvasView and taps a button to recognize what was written using PKStrokeRecognizer, displaying the result below the canvas.
import SwiftUI
import PencilKit
struct HandwritingCheckerView: View {
@State private var canvasView = PKCanvasView()
@State private var recognizedText: String = "Draw something above, then tap Recognize"
@State private var isRecognizing = false
var body: some View {
VStack(spacing: 16) {
Text("PencilKit Handwriting Recognition")
.font(.headline)
CanvasRepresentable(canvasView: $canvasView)
.frame(height: 260)
.border(Color.secondary, width: 1)
.cornerRadius(8)
HStack(spacing: 12) {
Button("Recognize") {
Task { await recognizeHandwriting() }
}
.buttonStyle(.borderedProminent)
.disabled(isRecognizing)
Button("Clear") {
canvasView.drawing = PKDrawing()
recognizedText = "Draw something above, then tap Recognize"
}
.buttonStyle(.bordered)
}
Text(recognizedText)
.font(.title2)
.multilineTextAlignment(.center)
.padding()
.frame(maxWidth: .infinity)
.background(Color(.secondarySystemBackground))
.cornerRadius(8)
Spacer()
}
.padding()
}
private func recognizeHandwriting() async {
guard !canvasView.drawing.strokes.isEmpty else {
recognizedText = "Please draw something first."
return
}
isRecognizing = true
defer { isRecognizing = false }
let recognizer = PKStrokeRecognizer()
// Optionally pin to a specific language:
// recognizer.preferredLanguages = [Locale.Language(identifier: "zh-Hans")]
let drawing = canvasView.drawing
let strokeIDs = drawing.strokes.map(\.id)
do {
let result = try await recognizer.recognizedText(
in: drawing,
strokeIDs: strokeIDs
)
recognizedText = result.isEmpty ? "(nothing recognized)" : result
} catch {
recognizedText = "Recognition failed: \(error.localizedDescription)"
}
}
}
struct CanvasRepresentable: UIViewRepresentable {
@Binding var canvasView: PKCanvasView
func makeUIView(context: Context) -> PKCanvasView {
canvasView.tool = PKInkingTool(.pen, color: .label, width: 5)
canvasView.backgroundColor = .systemBackground
canvasView.drawingPolicy = .anyInput
return canvasView
}
func updateUIView(_ uiView: PKCanvasView, context: Context) {}
}
#Preview {
HandwritingCheckerView()
}Liquid Glass is Apple's new material and visual design language introduced in iOS 27, bringing translucent, refractive glass-like surfaces to system and custom UI elements. It replaces the frosted vibrancy aesthetic with a more dynamic, depth-aware material that responds to content beneath it.
PaperKit is Apple's full-featured canvas framework — previously internal-only — now publicly available in iOS/macOS/visionOS 27. It powers the drawing and markup experience in Notes, Preview, and Freeform, giving developers access to a complete pencil, shapes, images, and text canvas with a rich data model.
iOS 27 brings significant updates to Live Activities and the Dynamic Island, including new expanded presentations, richer interactivity via App Intents directly from the island, and updated layout APIs for more expressive minimal and compact views.
In-depth guide
SwiftUI & Liquid Glass in iOS 27 →Recognition is async (PKStrokeRecognizer is a Swift actor); throttle calls to avoid excess power use. Stroke slicing on complex drawings can be expensive — prefer a background task. Indexable content should be re-indexed when recognizerVersion changes. Bézier conversion does not carry PencilKit-specific properties like force or opacity — you must supply those manually.
Handwriting recognition works on all iOS 27-supported devices; Simulator only supports Latin-character languages. Apple Pencil is not strictly required — any PKDrawing can be recognized.
iOS 27 enforces stricter adaptivity requirements for UIKit apps, making iPhone apps fully resizable in iPhone Mirroring and on iPad, while introducing new navigation bar minimization controls, sidebar opt-in for iPhone tab bars, and prominent tab customization.