swift-toolkit

readiumBSD-3-Clause活跃维护

用 Swift 编写的电子书、有声书和漫画阅读工具包,支持 EPUB、PDF、CBZ 及 OPDS 目录解析,帮 iOS 开发者快速搭建阅读器。

A toolkit for ebooks, audiobooks and comics written in Swift

3.11.1发布于 2026-10-16 13:29 UTC578star +1 / 7 天263fork同步于 2026-11-10 11:58 UTC

怎么上手

由 README 提炼,执行前请确认
SPM:在 Xcode 中 File > Add Packages,包地址填 https://github.com/readium/swift-toolkit.git
CocoaPods:在 Podfile 中添加 source 'https://github.com/readium/podspecs' 与 pod 'ReadiumShared', '~> 4.0.0-alpha.2'
硬件要求按 README 说明

README 未说明硬件要求;仅给出软件环境:iOS 15.0 起,需 Swift 6.0 与 Xcode 16.4(develop 分支要求 Swift 6.2、Xcode 26.4)。

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

Swift 编写的电子书、有声书与漫画阅读工具包,帮你快速搭建 iOS 阅读应用

用 Swift 编写的电子书、有声书和漫画阅读工具包,支持 EPUB、PDF、CBZ 及 OPDS 目录解析,帮 iOS 开发者快速搭建阅读器。

核心能力

  • 解析 EPUB、PDF、RWPM 为统一的 Publication 模型
  • 提供 Navigator 渲染分页、滚动与 RTL 排版
  • 支持正文搜索、高亮标注与 TTS 朗读
  • 内置 AudioNavigator 播放有声书与读取音频元数据
  • 支持 OPDS 1.2/2.0 目录与 Readium LCP DRM

容易踩的坑

CocoaPods 需额外添加 Readium 私有 podspec 源,否则找不到库;使用 Readium LCP 需向 EDRLab 申请私有的 R2LCPClient.framework 并按其说明配置;CBR 漫画格式与 Adobe ACS DRM 明确不支持。

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本3.11.1
  1. 3.11.1最新正式版2026-10-16 · 2026-10-16 13:29 UTC

    [!WARNING] Minor releases (a.B.c) of the Readium toolkit may now include minor breaking changes, such as dependency upgrades or small API modifications. Major version numbers are reserved for significant architectural changes.

    Documentation

    Changelog

    Changed

    LCP
    • Opening an LCP publication is no longer delayed by the CRL used to validate its license. The CRL is now downloaded when creating the LCPService, and an expired one is refreshed in the background instead of making the user wait for the response.

    Fixed

    Navigator
    LCP
    • The CRL used to validate LCP licenses is now checked to be a genuine X.509 CRL before being cached. Networks with a captive portal (e.g. on a plane) could return their login page with a 200 OK status, which was then cached for seven days and prevented opening LCP publications. An invalid CRL cached by a previous version is now ignored instead of waiting for its expiration.

    Full Changelog: https://github.com/readium/swift-toolkit/compare/3.11.0...3.11.1

  2. 4.0.0-alpha.2pre-release2026-09-18 · 2026-09-18 16:13 UTC
    查看更新说明

    [!WARNING] Minor releases (a.B.c) of the Readium toolkit may now include minor breaking changes, such as dependency upgrades or small API modifications. Major version numbers are reserved for significant architectural changes.

    Documentation

    Changelog

    Added

    Navigator
    • The EPUB navigator supports publications mixing reflowable and fixed-layout resources, rendering each resource according to its own layout.
    • New EPUBNavigatorViewController.Configuration.preferredResourceVariant to choose which variant of each resource is rendered among its alternates, such as the XHTML page or its bitmap fallback.
      • Bitmap resources in the reading order are rendered as fixed-layout, even in a reflowable publication.
    • New EPUBNavigatorDelegate.navigator(_:contentInsetFor:) to customize the content insets of a spread according to its EPUBLayout, for example to add margins only around the reflowable resources of a mixed-layout publication. It takes precedence over navigatorContentInset(_:).
    • New Navigator.readingOrder property returning the reading order actually rendered by the navigator, which may differ from publication.readingOrder when a custom reading order or a resource variant is used.

    Changed

    Shared
    • Converting a Link to a Locator is now synchronous: await publication.locate(link) becomes publication.locator(for: link). The logic moved to Manifest, so it is also available as manifest.locator(for: link) without a Publication.
    Navigator
    • In the EPUB navigator, a fixed-layout resource displayed on its own when spreads are enabled is now centered, unless the publication provides an explicit page position (e.g. page-spread-left). It was previously displayed on the left or right half of the viewport, depending on the reading progression.
    Streamer
    • EPUB spine items with a bitmap fallback are no longer swapped with their fallback. The spine item stays in the reading order and the bitmap is available in its alternates.
      • This changes the resources rendered by default and the href of the reported locations. Locations saved with the previous version are still restored by the EPUB navigator.
      • Use EPUBNavigatorViewController.Configuration.preferredResourceVariant = .image in the EPUB navigator configuration to render the bitmaps like before.
    LCP
    • Opening an LCP publication is no longer delayed by the CRL used to validate its license. The CRL is now downloaded when creating the LCPService, and an expired one is refreshed in the background instead of making the user wait for the response.

    Fixed

    Shared
    • #876 Fixed a crash (String index is out of bounds) in ContentSearchService when searching a publication containing characters merging with the surrounding text, such as combining diacritical marks.
    Navigator
    • #121 HTML <audio> and <video> elements are now paused when the resource moves off-screen in the EPUB navigator, rather than continuing to play in the background.
    • Fixed the PDF navigator's content being inset by the surrounding safe area (e.g. the navigation bar) on iOS 27.
    • #112 In the paginated EPUB navigator, horizontal swipes over the top and bottom margins of a reflowable resource now turn the page, instead of skipping to the previous or next resource.
    Streamer
    • #85 When an EPUB declares the same metadata with both an EPUB 2 <meta name=> tag and an EPUB 3 `<meta propert
  3. 4.0.0-alpha.1pre-release2026-08-14 · 2026-08-14 17:42 UTC
    查看更新说明

    [!WARNING] Minor releases (a.B.c) of the Readium toolkit may now include minor breaking changes, such as dependency upgrades or small API modifications. Major version numbers are reserved for significant architectural changes.

    Documentation

    Changelog

    Added

    Shared
    • Content elements now expose accessibleName, accessibleDescription and extendedDescription attributes, computed following a subset of the W3C accessible name computation and Best Practices for Implementing Extended Descriptions in EPUB.
    • The HTML content iterator now emits inline <svg> elements as SVGContentElement, with a caption from the enclosing figure's figcaption.
    • AudioContentElement and VideoContentElement now expose a caption property, filled from the enclosing figure's figcaption like images and SVGs already were.

    Changed

    • The toolkit is migrated to Swift 6 with strict concurrency checking. All packages compile in the Swift 6 language mode. See the migration guide.
      • The toolkit adopts the NonisolatedNonsendingByDefault (SE-0461), InferIsolatedConformances and MemberImportVisibility upcoming Swift features.
    Shared
    • OPDS models (Feed, Group, Facet, OpdsMetadata) are now structs with value semantics.
    • Publication, Resource, Container and related types are now Sendable. Custom implementations of Resource, Container, HTTPClient or PublicationService must be Sendable too.
    • Resource.stream() now cooperates with task cancellation: the built-in resources fail with ReadError.cancelled when the surrounding task is cancelled, and custom implementations are expected to do the same.
    • ImageContentElement.caption and SVGContentElement.caption are now strictly the text of the enclosing figure's figcaption. Other sources (such as alt) contribute to accessibleName instead.
    • Audio and video content elements now expose accessibility attributes, so the text-to-speech may start speaking their labels.
    Navigator
    • The Navigator and VisualNavigator protocols and their delegates are now isolated to the main actor.
    LCP
    • LCPService.init now requires an explicit deviceName parameter. We recommend passing UIDevice.current.name. See the migration guide.
    • LCPDialogAuthentication no longer takes a sender view controller. It now presents its passphrase dialog through a new LCPDialogAuthenticationDelegate that you implement and retain for the lifetime of the authentication. See the Readium LCP guide and the migration guide.

    Removed

    • The deprecated ReadiumAdapterGCDWebServer and ReadiumAdapterLCPSQLite adapter packages have been removed.
    • The ReadiumInternal package has been removed. Its utilities were internal helpers and are now folded into ReadiumShared with package visibility. If you imported ReadiumInternal directly, remove the import.

    What's Changed

  4. 3.11.02026-07-17 · 2026-07-17 08:27 UTC
    查看更新说明

    [!WARNING] Minor releases (a.B.c) of the Readium toolkit may now include minor breaking changes, such as dependency upgrades or small API modifications. Major version numbers are reserved for significant architectural changes.

    Documentation

    Changelog

    Added

    Navigator
    • Added the AudioSessionManaging protocol, letting apps provide their own audio session manager instead of the built-in AudioSession (contributed by @svenmeyers89).
    LCP
    • LCPService has a new addPassphrase(_:isHashed:userID:provider:) method to store a passphrase candidate in the repository without opening a license first. Useful to preload a passphrase ahead of time (e.g. from a catalog).
    • LCPClient has a new getSupportedLCPProfileURIs() requirement, letting the toolkit report LCPError.licenseProfileNotSupported based on the profiles the embedded liblcp actually supports. Update your LCPClient facade to forward R2LCPClient.getSupportedLCPProfileURIs() (a default implementation is provided for backward compatibility).

    Changed

    LCP
    • The auto-generated LCP device ID is now stored in the Keychain instead of UserDefaults, so it survives an app delete/reinstall and no longer needlessly consumes a license's device-registration slots. Existing IDs are automatically migrated from UserDefaults.

    Fixed

    Shared
    • EPUB HREFs that are not percent-encoded but carry a fragment or query (e.g. chapter one.xhtml#section, with a space in the filename) now keep their #fragment/?query instead of encoding the separators into the path. This fixes table of contents and Media Overlays links failing to resolve and navigate in poorly-authored EPUBs.
    Navigator
    • Fixed custom EditingActions sometimes missing from the text-selection menu for double-tap (single word) selections (contributed by @raphi011).
    • Fixed memory leak in the AudioNavigator.
    • #802 Fixed fonts declared with fontFamilyDeclarations never loading in the EPUB navigator. Font fetches were CORS-gated by WebKit (contributed by @atani).

    What's Changed

  5. 3.10.02026-06-24 · 2026-06-24 13:36 UTC
    查看更新说明

    [!WARNING] Minor releases (a.B.c) of the Readium toolkit may now include minor breaking changes, such as dependency upgrades or small API modifications. Major version numbers are reserved for significant architectural changes.

    Documentation

    Changelog

    Changed

    LCP
    • LCPPassphraseRepository.addPassphrase(_:userID:provider:) no longer takes a license ID, and provider is now optional. A convenience addPassphrase(_:) overload is available for storing a passphrase without any associated user or provider.

    Fixed

    Shared
    • ZIP entry names stored with a leading slash (e.g. /001.jpg, found in some CBZ comics) are now normalized to relative paths. Previously such entries resolved as absolute-path references against the base URL, causing them to fail.
    Navigator
    • Fixed EPUB footnotes never being detected when tapped, which prevented EPUBNavigatorDelegate.navigator(_:shouldNavigateToNoteAt:content:referrer:) from being called and made footnote references navigate to the note's location instead of being handled by the host (contributed by @raphi011).
    LCP
    • #818 Repository failures during passphrase lookup (e.g. Keychain access errors) now fall through gracefully to the interactive authentication flow instead of propagating the error.

    What's Changed

    New Contributors

    Full Changelog: https://github.com/readium/swift-toolkit/compare/3.9.0...3.10.0

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    Readium Swift Toolkit

    Readium Mobile is a toolkit for ebooks, audiobooks and comics written in Swift & Kotlin.

    [!TIP] Take a look at the guide to quickly get started. A Test App demonstrates how to integrate the Readium Swift toolkit in your own reading app.

    Features

    ✅ Implemented      🚧 Partially implemented      📆 Planned      👀 Want to do      ❌ Not planned

    Formats

    Ebook and Document Formats
    FormatStatus
    EPUB (reflowable)✅
    EPUB (fixed-layout)✅
    PDF✅
    Readium Web Publication🚧
    DAISY👀
    Audiobook Formats
    FormatStatus
    Readium Audiobook✅
    Zipped Audiobook✅
    Standalone audio files (MP3, AAC, etc.)✅
    DAISY👀
    Comic Formats
    FormatStatus
    Readium Divina✅
    CBZ (Comic Book ZIP)✅
    CBR (Comic Book RAR)❌

    Features

    A number of features are implemented only for some publication formats.

    FeatureEPUB (reflow)EPUB (FXL)PDF
    Pagination✅✅✅
    Scrolling✅👀✅
    Right-to-left (RTL)✅✅✅
    Search in textual content✅✅✅
    Highlighting (Decoration API)✅✅👀
    Text-to-speech (TTS)✅✅👀
    Media overlays📆📆

    OPDS Support

    FeatureStatus
    OPDS Catalog 1.2✅
    OPDS Catalog 2.0✅
    Authentication for OPDS📆
    OPDS Progression📆
    Readium LCP Automatic Key Retrieval📆

    DRM Support

    FeatureStatus
    Readium LCP✅
    Adobe ACS❌

    User Guides

    Guides are available to help you make the most of the toolkit.

    Publication

    Navigator

    DRM

    Setting up the Readium Swift toolkit

    Minimum Requirements

    ReadiumiOSSwift compilerXcode
    develop15.06.226.4
    3.8.015.06.016.4
    3.0.013.45.1015.4
    2.5.111.05.6.113.4
    2.5.010.05.6.113.4
    2.4.010.05.3.212.4

    Dependencies

    The toolkit's libraries are distributed with Swift Package Manager (recommended) and CocoaPods. It's also possible to clone the repository (or a fork) and depend on the libraries locally.

    The Test App contains examples on how to use all these dependency managers.

    Swift Package Manager

    From Xcode, open File > Add Packages and use Readium's GitHub repository for the package URL: https://github.com/readium/swift-toolkit.git.

    You are then free to add one or more Readium libraries to your application. They are designed to work independently.

    If you're stuck, find more information at developer.apple.com.

    CocoaPods

    Add the following pod statements to your Podfile for the Readium libraries you want to use:

    source 'https://github.com/readium/podspecs'
    source 'https://cdn.cocoapods.org/'
    
    pod 'ReadiumShared', '~> 4.0.0-alpha.2'
    pod 'ReadiumStreamer', '~> 4.0.0-alpha.2'
    pod 'ReadiumNavigator', '~> 4.0.0-alpha.2'
    pod 'ReadiumOPDS', '~> 4.0.0-alpha.2'
    pod 'ReadiumLCP', '~> 4.0.0-alpha.2'
    

    Take a look at CocoaPods's documentation for more information.

    Local Git Clone

    You may prefer to use a local Git clone if you want to contribute to Readium, or if you are using your own fork.

    First, add the repository as a Git submodule of your app repository, then checkout the desired branch or tag:

    git submodule add https://github.com/readium/swift-toolkit.git
    

    Next, drag and drop the whole swift-toolkit folder into your project to import Readium as a Swift Package.

    Finally, add the Readium libraries you want to use to your app target from the General tab, section Frameworks, Libraries, and Embedded Content.

    Building with Readium LCP

    Using the toolkit with Readium LCP requires additional dependencies, including the framework R2LCPClient.framework provided by EDRLab. Contact EDRLab to request your private R2LCPClient.framework and the setup instructions.

    Credits

    This project is tested with BrowserStack.