Readium Mobile 是一个使用 Swift 和 Kotlin 编写的电子书、有声读物和漫画工具包。
☝️ 请查看入门指南。 测试应用演示了如何在您自己的阅读应用程序中集成 Readium Swift 工具包。
此工具包是一个模块化项目,它遵循 Readium 架构。
ReadiumShared – 共享的 Publication 模型和实用工具ReadiumStreamer – Publication 解析器和本地 HTTP 服务器ReadiumNavigator – 渲染 Publication 的纯 UIViewController 类ReadiumOPDS – OPDS 目录源的解析器ReadiumLCP – Readium LCP 的服务和模型| Readium | iOS | Swift 编译器 | Xcode |
|---|---|---|---|
develop |
13.4 | 5.10 | 15.4 |
| 3.0.0 | 13.4 | 5.10 | 15.4 |
| 2.5.1 | 11.0 | 5.6.1 | 13.4 |
| 2.5.0 | 10.0 | 5.6.1 | 13.4 |
| 2.4.0 | 10.0 | 5.3.2 | 12.4 |
Readium 库通过 Swift Package Manager(推荐)、Carthage 和 CocoaPods 分发。也可以克隆仓库(或一个分支)并本地依赖库。
测试应用 包含关于如何使用所有这些依赖管理器的示例。
从 Xcode 中,打开 File > Add Packages 并使用 Readium 的 GitHub 仓库作为包 URL:https://github.com/readium/swift-toolkit.git。
然后您可以自由地将一个或多个 Readium 库添加到您的应用程序中。它们被设计为独立工作。
如果您遇到困难,请在 developer.apple.com 找到更多信息。
将以下内容添加到您的 Cartfile
github "readium/swift-toolkit" ~> 3.1.0
然后,按照通常的 Carthage 步骤 将 Readium 库添加到您的项目中。
请注意,Carthage 将构建所有 Readium 模块及其依赖项,但您可以自由地仅添加您实际使用的模块。 Readium 库被设计为独立工作。
请参考下表以了解每个 Readium 库所需的依赖项。
ReadiumShared |
ReadiumStreamer |
ReadiumNavigator |
ReadiumOPDS |
ReadiumLCP |
ReadiumAdapterGCDWebServer |
ReadiumAdapterLCPSQLite |
|
|---|---|---|---|---|---|---|---|
ReadiumShared |
✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | |
ReadiumInternal |
✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ||
CryptoSwift |
✔️ | ✔️ | |||||
DifferenceKit |
✔️ | ||||||
ReadiumFuzi |
✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ||
ReadiumGCDWebServer |
✔️ | ||||||
ReadiumZIPFoundation |
✔️ | ✔️ | |||||
Minizip |
✔️ | ||||||
SQLite.swift |
✔️ | ||||||
SwiftSoup |
✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
将以下 pod 语句添加到您的 Podfile 中,用于您想要使用的 Readium 库
source 'https://github.com/readium/podspecs'
source 'https://cdn.cocoapods.org/'
pod 'ReadiumShared', '~> 3.1.0'
pod 'ReadiumStreamer', '~> 3.1.0'
pod 'ReadiumNavigator', '~> 3.1.0'
pod 'ReadiumOPDS', '~> 3.1.0'
pod 'ReadiumLCP', '~> 3.1.0'
请查看 CocoaPods 的文档 以获取更多信息。
如果您想为 Readium 做出贡献,或者您正在使用自己的分支,您可能更喜欢使用本地 Git 克隆。
首先,将仓库添加为您的应用程序仓库的 Git 子模块,然后检出所需的分支或标签
git submodule add https://github.com/readium/swift-toolkit.git
接下来,将整个 swift-toolkit 文件夹拖放到您的项目中,以将 Readium 作为 Swift Package 导入。
最后,从 General 选项卡中的 Frameworks, Libraries, and Embedded Content 部分,将您想要使用的 Readium 库添加到您的应用程序目标。
将工具包与 Readium LCP 一起使用需要额外的依赖项,包括 EDRLab 提供的框架 R2LCPClient.framework。 联系 EDRLab 以请求您的私有 R2LCPClient.framework 和设置说明。
此项目使用 BrowserStack 进行测试。