PSPDFKit 10.3 Migration Guide

This guide covers updating an iOS or Mac Catalyst project from PSPDFKit 10.2 for iOS to PSPDFKit 10.3 for iOS. We expect this to be a fast and easy upgrade. We encourage you to update as soon as possible to take advantage of future new features and fixes.

Optional Improvements

This release adds support for the Optimize Interface for Mac setting for Mac Catalyst apps. If you previously weren’t using the setting because of PSPDFKit, you can now enable it.

If you implement an object conforming to the SignatureStore protocol, then you no longer need to implement init(storeName:) and storeName because these requirements were moved to our concrete implementation, KeychainSignatureStore. The name of a store was never read by PSPDFKit.

The store name parameter may now be omitted when initializing a KeychainSignatureStore. The default store name will be used in this case. In other words, you can change KeychainSignatureStore(storeName: KeychainSignatureStore.DefaultStoreName) to KeychainSignatureStore().

Breaking API Changes

There are a few API changes that may require straightforward updates. Attempt to compile your project after updating PSPDFKit. If you encounter any compiler errors where your project calls PSPDFKit APIs, then you can find the recommended migration approaches below. If there are no compiler errors, then no integration changes are necessary.

Error handling has been added to the DataProviding protocol. The data property has been replaced by the data() throwing function, and readData(withSize:atOffset:) is now a throwing function. These both return NSError by reference in Objective-C. Update your implementation to account for the possibility of errors occurring.

Furthermore, the deprecated DataProviding method replace(with:) has been removed. Use the renamed alternative replaceContents(with:).

The MenuItem.identifier property has been changed from read-write to read-only because identifiers should not be changed. Set the identifier when initializing the object.

All initializers of SearchViewController except init(document:) have been marked as unavailable. Ensure you use init(document:). Note that using any other initializer in a previous version of PSPDFKit would not have worked at runtime anyway.

The type of the PDFConfiguration.signatureStore property has changed from required to optional because there can now be no signature store set. If you’re reading this property, account for the possibility of nil — such as with optional chaining or force unwrapping — if you’re sure you’ve set this to a non-nil value.

The UIHostingView class has been removed. This was a general helper for SwiftUI and UIKit interoperability. Use your own helper for this instead, such as the one from the SwiftUIX project.

Electronic Signatures

This release adds the Electronic Signatures component. If you use the older signing functionality as part of the Annotations component and would like to update to Electronic Signatures, see our guide on migrating to electronic signatures. If you continue to use the older signing functionality, then no integration changes are necessary.