Swiftpack.co - readium/swift-toolkit as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by readium.
readium/swift-toolkit 2.3.0
A toolkit for ebooks, audiobooks and comics written in Swift
⭐️ 63
🕓 16 weeks ago
iOS
.package(url: "https://github.com/readium/swift-toolkit.git", from: "2.3.0")

Readium Swift Toolkit

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

This toolkit is a modular project, which follows the Readium Architecture.

A Test App demonstrates how to integrate the Readium Swift toolkit in your own reading app

Using Readium

Readium libraries are distributed with Swift Package Manager (recommended), Carthage 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.

Carthage

Add the following to your Cartfile:

github "readium/swift-toolkit" ~> 2.3.0

Then, follow the usual Carthage steps to add the Readium libraries to your project.

Note that Carthage will build all Readium modules and their dependencies, but you are free to add only the ones you are actually using. The Readium libraries are designed to work independently.

Refer to the following table to know which dependencies are required for each Readium library.

R2Shared R2Streamer R2Navigator ReadiumOPDS ReadiumLCP
R2Shared :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark:
CryptoSwift :heavy_check_mark: :heavy_check_mark:
DifferenceKit :heavy_check_mark:
Fuzi :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark:
GCDWebServer :heavy_check_mark:
Minizip :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark:
SQLite.swift :heavy_check_mark:
SwiftSoup :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark:
ZIPFoundation :heavy_check_mark:

CocoaPods

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

pod 'R2Shared', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/2.3.0/Support/CocoaPods/ReadiumShared.podspec'
pod 'R2Streamer', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/2.3.0/Support/CocoaPods/ReadiumStreamer.podspec'
pod 'R2Navigator', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/2.3.0/Support/CocoaPods/ReadiumNavigator.podspec'
pod 'ReadiumOPDS', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/2.3.0/Support/CocoaPods/ReadiumOPDS.podspec'
pod 'ReadiumLCP', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/2.3.0/Support/CocoaPods/ReadiumLCP.podspec'

# Required if you use R2Streamer.
pod 'GCDWebServer', podspec: 'https://raw.githubusercontent.com/readium/GCDWebServer/3.6.3/GCDWebServer.podspec'

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.

GitHub

link
Stars: 63
Last commit: 2 days ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Related Packages

Release Notes

2.3.0
17 weeks ago

Take a look at the migration guide

Added

Shared

  • Get the sanitized Locator text ready for user display with locator.text.sanitized().
  • A new Publication.conforms(to:) API to identify the profile of a publication.
  • Support for the conformsTo RWPM metadata, to identify the profile of a Publication.
  • Support for right-to-left PDF documents by extracting the reading progression from the ViewerPreferences/Direction metadata.
  • HTTP client:
    • A new HTTPClient.download() API to download HTTP resources to a temporary location.
    • HTTPRequest and DefaultHTTPClient take an optional userAgent property to customize the user agent.

Navigator

  • The new NavigatorDelegate.navigator(_:didJumpTo:) API is called every time the navigator jumps to an explicit location, which might break the linear reading progression.
    • For example, it is called when clicking on internal links or programmatically calling Navigator.go(to:), but not when turning pages.
    • You can use this callback to implement a navigation history by differentiating between continuous and discontinuous moves.

Deprecated

Shared

  • Publication.format is now deprecated in favor of the new Publication.conforms(to:) API which is more accurate.
    • For example, replace publication.format == .epub with publication.conforms(to: .epub) before opening a publication with the EPUBNavigatorViewController.

Changed

LCP

  • The LCPService now uses a provided HTTPClient instance for all HTTP requests.

Fixed

Navigator

  • #14 Backward compatibility (iOS 10+) of JavaScript files is now handled with Babel.
  • Throttle the reload of EPUB spreads to avoid losing the position when the reader gets back to the foreground.

LCP

  • Fixed the notification of acquisition progress.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics