Blog Post

PSPDFKit 9.3 for iOS

We’re excited to announce PSPDFKit 9.3 for iOS. In this release, we focused on further improving our APIs for Swift by refining the naming of all types, as well as converting more loosely typed Objective-C APIs to strong types in Swift. In addition to this API work, we also managed to squeeze in some great new features! They include initial support for the just-released cursor functionality on iPad, stricter adherence to PDF document permissions, a new annotation toolbar position, additional Dark Mode tweaks, and more.

Swift API

Like most iOS developers, we’re big fans of Swift over here at PSPDFKit. Since the early days of the language, we’ve been doing our best to adopt available compiler features to make sure using PSPDFKit with Swift is as seamless as possible, while also ensuring full compatibility for our customers still using Objective-C. To that degree, we adopted nullability specifiers, generics, and extensible enums throughout the framework. We even provided custom Swift API wrappers in the form of PSPDFKitSwift, which has been part of our regular distribution since PSPDFKit 9.

With this release, we’re taking the next big step toward first-class Swift support by comprehensively refining our APIs. The first thing you’ll notice after updating is that we dropped the PSPDF prefix from our type names. This is a legacy Objective-C pattern that is not needed in Swift because Swift modules provide an implicit namespace. In addition to this rename, we also updated type and method names so that they’re more suitable for Swift. In a lot of places, this also included nesting types into other types.

In addition to improving naming, we focused on type safety throughout the framework. On that front, we converted even more Objective-C string constants to Swift enumerations and introduced a new protocol named Overridable. The latter explicitly marks classes that can be subclassed via the PSPDFKit subclassing API, thereby ensuring there is no confusion as to whether or not a particular class supports subclassing.

You’ll be able to adopt most of these changes automatically by leveraging Xcode fixits. For everything else, we’ve prepared a migration guide that will help you make the necessary changes to your integration.

iPad Trackpad Support

With iPadOS 13.4, Apple introduced a brand-new cursor implementation for the iPad that already works great with any Bluetooth mouse or trackpad. It will also be a key feature leveraged by the newly introduced Magic Keyboard. Even though we’ve only had a few days to explore this new API, we managed to make progress and are already shipping the first custom cursor behaviors in PSPDFKit 9.3. You’ll be able to notice the customizations when selecting text, hovering over PDF links, and resizing annotations. But this is just the first step. We’re committed to building upon this and providing comprehensive support for the iPad cursor throughout the framework in future releases.

Document Permissions

A PDF document defines a set of permissions that enable or disable certain actions a user can take within the document. These permissions cover things like printing, annotation modification, and content extraction. Prior to this release, PSPDFKit could read and write user permissions, but most of them were ignored by the PSPDFKit document viewer and other UI elements.

PSPDFKit 9.3 for iOS adds comprehensive support for all available document permissions so that the relevant UI actions are enabled or disabled based on the state of document permissions. With this, PSPDFKit better adheres to the PDF standard and ensures documents can be properly locked down by PDF authors, in order to prevent accidental modification or unintended actions.

These restrictions are applied at the UI level. If you’d like to adopt the same behavior in any custom user interface elements, please take a look at the DocumentFeatures API. For more information on what changed and how to customize this behavior, please refer to the migration guide.

Annotation Toolbar

The annotation toolbar can now optionally be configured to be displayed in a second row below the navigation bar instead of just overlapping it or being positioned vertically on any side of the screen. This option is disabled by default, but it can easily be configured by adjusting the supportedToolbarPositions property of the annotation toolbar. To learn more and to see this in action, you can take a look at the new ToolbarPositionTopExample class in the PSPDFKit Catalog.

Annotation Toolbar Top Position

Text selection works differently, depending on the input created: Use touches and you get selection handles and some delay to allow scrolling. With an indirect input device, text selection is immediate and doesn’t require handles, as the input device is more accurate by default. Our custom logic nicely handles both cases.

Document Editor Toolbar Top Position

Dark Mode

Since the release of iOS 13, we’ve been incrementally refining support for Dark Mode throughout the framework. In PSPDFKit 9.3, we added support for Dark Mode to the signing UI and to some remaining elements on the annotation inspector. With this, PSPDFKit now fully supports Dark Mode in all major UI components.

Previous Signature UI New Signature UI
Previous Signature UI in Dark Mode - Yellow New Signature UI in Dark Mode - Yellow

More Details

In addition to everything mentioned above, we also focused on some other key parts of the framework. One of those areas is that of free text annotations, which now come with better auto-sizing behaviors when modifying the text contents or text attributes of annotations. We also improved keyboard avoidance both when editing free text annotations and when working with other text input.

Another area that received some attention is accessibility. We enhanced support for accessibility text sizes in some parts of the framework, and we enabled better Voice Control behaviors in table views by separating the accessibility value from the accessibility label. Finally, this release also includes a brand-new localization: British English.

To see a complete list of changes, including all smaller enhancements and fixes, check out the PSPDFKit 9.3 for iOS changelog.

Share Post
Free 60-Day Trial Try PSPDFKit in your app today.
Free Trial

Related Articles

Explore more
DEVELOPMENT  |  iOS • Swift • Tips • UI/UX • Insights

Supporting Pointer Interactions

TUTORIALS  |  iOS • Web • Swift • React • How To • SwiftUI

Introduction to SwiftUI for React Developers (Part 2)

TUTORIALS  |  iOS • Web • Swift • React • How To • SwiftUI

Introduction to SwiftUI for React Developers (Part 1)