Blog Post

PSPDFKit 10.1 Takes SwiftUI to the Next Level

Today we’re introducing PSPDFKit 10.1 for iOS. Our release follows Xcode 12.2 and matches its support for macOS Big Sur and Apple Silicon. Along with enabling development for Apple’s new operating system and CPU architecture, PSPDFKit 10.1 also vastly enhances our support for SwiftUI with new APIs and an extensive suite of examples. We also spent more time polishing our Apple Pencil Scribble integration by adopting custom behaviors for text annotations.

Apple Silicon

One of the main open secrets ahead of this year’s WWDC was that Apple intended to transition the Mac lineup from Intel x86 to its own ARM-based CPU architecture. This is now known as the transition to Apple Silicon. The announcement officially started a period during which Mac software will have to support both architectures at the same time. We’re happy to announce that with the release of PSPDFKit 10.1 for iOS and PSPDFKit 5.1 for macOS, our Mac Catalyst and AppKit Mac frameworks are available as fat binaries and thus fully support the new Mac architecture.

SwiftUI

SwiftUI is slowly transitioning from being a fun playground technology for early adopters to being a full-fledged and production-ready UI framework. We decided to follow the trend and upgrade our existing SwiftUI support, which has been available since PSPDFKit 9, with a new base view: PDFView. This supports a list of custom view modifiers for common configuration options. We also added Combine publishers for important document and annotation events, as well as a large set of dedicated SwiftUI examples.

The added examples include a full standalone SwiftUI project named SwiftUIDocumentBrowser which, as the name suggests, shows how PSPDFKit can be integrated with the system document browser using just SwiftUI. Next to it you’ll find five new SwiftUI code examples, which are part of our Catalog project. These include an extensive sidebar example, which shows how to recreate our document info UI from scratch using SwiftUI. There’s also a split-screen UI example, plus three smaller examples showing specific customization options.

Along with the examples, we’ve prepared a new SwiftUI guide, which you can consult to learn more about integrating PSPDFKit into your SwiftUI projects. If you’re curious about some behind-the-scenes technicalities, you might want to check out a talk on this subject given by our founder, Peter Steinberger, at Swift Heroes Digital 2020.

Scribble

Scribble is a new iOS 14 feature that turns handwriting from Apple Pencil into text. PSPDFKit 10.1 builds on top of the initial support for Scribble introduced in PSPDFKit 10 by adding custom behaviors when working with text annotations. When in text annotation mode, you now no longer need to select an insertion point for new annotations. Instead, you can simply start writing. You also no longer need to first select existing text annotations if you’d like to append text or use the Scribble text deletion gesture. You can read more about the Scribble improvements in our Extending the Scribble User Experience blog post.

More Details

While PSPDFKit 10.1 for iOS already features various fixes and improvements to our Mac Catalyst framework on Big Sur, it doesn’t yet support the new Optimize Interface for Mac option. Like other developers, we’ve found that this mode has countless issues that are rooted in the system and are hard to work around. Until the situation improves, we recommend not enabling the Optimize Interface for Mac option in your Mac Catalyst applications if they leverage the PSPDFKit UI.

In recent weeks, we’ve spent a lot of time profiling and optimizing PSPDFKit to eradicate bottlenecks that could occur in complex PDF documents. We’re happy to share that we made some significant improvements that can result in some documents loading more than an order of magnitude faster. Some of these were made available in PSPDFKit 10.0.1, while others are now available in PSPDFKit 10.1.

PSPDFKit 10.1 also features several refinements to annotation creation and manipulation. We’ve added new behaviors that improve drawing with Apple Pencil, along with erasing and undo. We also improved the callout annotation so that it better adjusts its arrow when entering text.

In addition to the new SwiftUI examples, we added several other examples to our Catalog — most notably a streaming document Catalog example (StreamingDocumentExample.swift), which highlights how a PDF file can be streamed page-by-page from a server for faster display.

As always, to see a complete list of changes, check out the PSPDFKit 10.1 for iOS changelog.

Author
Matej Bukovinski CTO

Matej is a software engineering leader from Slovenia. He began his career freelancing and contributing to open source software. Later, he joined PSPDFKit, where he played a key role in creating its initial products and teams, eventually taking over as the company’s Chief Technology Officer. Outside of work, Matej enjoys playing tennis, skiing, and traveling.

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

Related Articles

Explore more
DEVELOPMENT  |  iOS • Swift • Tips

Caching File Downloads with URLCache in Swift

DEVELOPMENT  |  iOS • Swift • Tips • SwiftUI • UI/UX

Presenting Popovers from SwiftUI

TUTORIALS  |  iOS • Swift • How To • UI/UX

Extending the Scribble User Experience