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
and PSPDFFormElement
.
Previously, PSPDFFormElement
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
is strictly only an annotation that will be displayed on the screen, while PSPDFFormField
takes over all the backend work of modifying form field states.
Changes
In addition to being able to get all PSPDFFormElement
s from PSPDFFormParser
, 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
using the formField
property.
The PSPDFFormField
has an annotations
property that lists all annotations connected to this specific form field. For example, a PSPDFButtonFormField
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
.
The PSPDFWidgetAnnotation
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
, 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
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
to PSPDFBaseConfigurationBuilder
. 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
:
let configuration = PSPDFConfiguration { (builder: PSPDFConfigurationBuilder) in
This works correctly on Swift 3 and doesn’t need any casting.