This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /guides/ios/events-and-notifications/forms.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. iOS PDF form events and notifications

Form elements are based on annotations, so you can use Notification.Name.PSPDFAnnotationChanged to listen for user input in forms:

// Start listening to the change notifications from all annotations.
NotificationCenter.default.addObserver(self, selector: #selector(annotationChanged(_:)), name: .PSPDFAnnotationChanged, object: nil)
@objc func annotationChanged(_ notification: Notification) {
// Make sure it was a text field that changed.
guard let annotation = notification.object as? TextFieldFormElement else {
return
}
// Make sure that the annotation is in the currently handled document.
guard annotation.document === self.document else {
return
}
// Make sure that the contents, and not the style, changed.
guard let keyPaths = notification.userInfo?[PSPDFAnnotationChangedNotificationKeyPathKey] as? [String], keyPaths.contains(#keyPath(Annotation.contents)) else {
return
}
// Handle the change.
print("Text field content changed: \(annotation.contents!)")
}

The technique above can also be used to listen for changes in other types of form fields.