PSPDFKit 6.5 Migration Guide
PSPDFKit 6.5 for iOS is our latest framework update.
Forms
In this version, we completely reengineered how form fields are represented in PSPDFKit. The biggest difference is that form elements are split into two distinct classes now: PSPDFFormField
(opens in a new tab) and PSPDFFormElement
(opens in a new tab).
Previously, PSPDFFormElement
(opens in a new tab) represented both non-UI form field data and the widget annotation. This occasionally caused problems and required us to keep a hierarchy of annotations. With this change, a PSPDFFormElement
(opens in a new tab) is strictly only an annotation that will be displayed on the screen, while PSPDFFormField
(opens in a new tab) takes over all the backend work of modifying form field states.
Changes
In addition to being able to get all PSPDFFormElement
(opens in a new tab)s from PSPDFFormParser
(opens in a new tab), we introduced a property called formFields
for retrieving all form fields.
The parent
or kids
properties are no longer available because a PSPDFFormElement
no longer forms a hierarchy. You can retrieve the linked PSPDFFormField
(opens in a new tab) using the formField
property.
The PSPDFFormField
(opens in a new tab) has an annotations
property that lists all annotations connected to this specific form field. For example, a PSPDFButtonFormField
(opens in a new tab) can have multiple PSPDFButtonFormElement
s listed in its annotations
property, all of which form one radio button group.
Properties that only dealt with form field data, like mappingName
and alternativeFieldName
, have been moved to PSPDFFormField
(opens in a new tab).
The PSPDFWidgetAnnotation
(opens in a new tab) property shouldRenderApperanceStream
has been removed due to internal changes that require us to render the appearance stream.
After setting the contents
or value
of a PSPDFFormElement
(opens in a new tab), it’s no longer necessary to send a PSPDFAnnotationChangedNotification
notification. This will be handled by the framework internally, and the UI will update accordingly.
XFDF Changes
Previously, it was possible to import PSPDFFormElement
(opens in a new tab) annotations using XFDF. According to the XFDF spec, this is actually not supported and has been removed.
Swift 2.3
With PSPDFKit 6.5 for iOS, we changed the superclass of PSPDFConfigurationBuilder
(opens in a new tab) to PSPDFBaseConfigurationBuilder
(opens in a new tab). When using Swift 2.3, this type isn’t correctly inferred, which leads to a compiler error, and which seems to be a bug in Swift 2.3. To fix this, you need to cast the closure parameter to PSPDFConfigurationBuilder
(opens in a new tab):
let configuration = PSPDFConfiguration { (builder: PSPDFConfigurationBuilder) in
This works correctly on Swift 3 and doesn’t need any casting.