Release Note · Swift Toolkit Version 3.9.0
We are happy to announce the release of the Readium Swift Toolkit 3.9.0. This update delivers major performance gains for PDF, brings a series of refinements to the EPUB and PDF navigators, and introduces the new Playground app.
Browse the full release on Github
Introducing the Playground app
We are introducing a new Playground iOS app as part of the toolkit repository. It is a minimal SwiftUI application designed to help you discover and test the toolkit's APIs without the overhead of a full-featured reader app.
The Recipes/ folder is the heart of the Playground: each recipe is a self-contained, reusable code snippet demonstrating a specific toolkit feature. Whether you are exploring the APIs, experimenting with preferences, or testing a feature you are about to integrate, the Playground is the fastest way to get hands-on with the toolkit.
PDF: dramatically faster, lighter, and now searchable
This release brings significant performance improvements to opening PDF documents. Opening a regular PDF is now approximately 99% faster, and opening an LCP-protected PDF is approximately 94% faster. Non-protected PDFs no longer have an arbitrary size cap when loading.
Beyond speed, the PDF navigator no longer requires an embedded HTTP server. The ReadiumAdapterGCDWebServer dependency can be removed from your project entirely — see the migration guide for instructions.
PDF publications now also support text extraction and search through the Content and Search APIs, powered by the new ContentSearchService. This brings PDF in line with EPUB in terms of search capability. Note that TTS is not yet available for PDF, as sentence segmentation still needs further work.
Finally, if a PDF resource cannot be loaded into memory safely, the toolkit now reports this as ReadError.outOfMemory instead of crashing, giving you a clean error path to handle low-memory conditions.
Image handling improvements
SVG images can now be used as publication covers. The ResourceCoverService detects and renders SVG covers to bitmaps automatically.
Alongside this, a new experimental coverData(accepting:) method on Publication returns the raw bytes and media type of the cover without re-encoding it. This is useful when you want to store or cache the original cover file exactly as it appears in the publication, rather than going through a lossy bitmap round-trip.
For reading apps that want to support image zoom, the EPUB navigator now populates PointerEvent.targetElement when the user taps an image. This gives your tap handler the information it needs to identify which image was tapped and display it in a zoom view. See the user guide for integration details.
EPUB and PDF Navigators refinements
The EPUB and PDF navigators now both implement the new ViewportObservingNavigator protocol, which exposes the current visible portion of the publication — including progression and position ranges. This gives you a live window into what the reader is currently viewing, useful for features like chapter progress indicators or exact bookmark matching.
Progress reporting for the EPUB navigator has also been improved. The locator.locations.totalProgression value is now continuous, interpolated from the actual scroll position within the resource's global progression range. Previously it was quantized to the nearest item in the position list, which produced noticeable jumps during scrolling.
Page turn animations have been refined as well. A slide animation is now used when navigating between adjacent resources, and a long-standing screen glitch that appeared when animations were disabled has been fixed.
The DirectionalNavigationAdapter's policies and animated transitions are now mutable, so you can update the adapter's behavior at runtime after creation.
Technical updates and breaking changes
- Carthage support removed: Carthage is no longer a supported distribution method. If your project still uses Carthage to integrate the toolkit, please migrate to Swift Package Manager.
ReadiumAdapterGCDWebServerdeprecated: With the PDF navigator no longer requiring an HTTP server, this adapter has no remaining role in the toolkit. You can remove the dependency from your project.- Type-safe JSON (
JSONValue): All public types that parsed or serialized JSON now use the newJSONValueenum instead ofAnyand[String: Any]. This is a breaking change that affects any code consuming or producing raw JSON through the toolkit's APIs. The migration guide covers the upgrade path in detail. - Bug fixes: A performance bottleneck in
HTMLResourceContentIterator(used by TTS andpublication.content()) where CSS selector generation was O(N²) has been corrected. SeveralURITemplateparsing edge cases were also fixed, andPublication.coverFitting(maxSize:)no longer produces incorrectly scaled images. EPUB contributor parsing was improved to correctly handlemedia:narratorroles, MARC relator roles ondc:creator, and role leakage into therolesfield.
