How readium/swift-toolkit works
Project type and purpose
• This is a modular Swift toolkit for ebook/audiobook/comic reading. It exposes multiple independent frameworks (Shared, Streamer, Navigator, OPDS, LCP, plus Adapters).
• A TestApp demonstrates how to compose these frameworks into a reading application.
File structure
• Sources/ houses the core Swift modules:
• Adapters (GCDWebServer, LCPSQLite)
• Internal (utility extensions, JSON, Measure, etc.)
• Shared (low-level toolkit: HTTP, ZIP, format sniffers, XML, URL, archive, logging)
• Streamer (publication parsing: EPUB, PDF, audio, Readium webpub)
• OPDS (catalog parsing)
• LCP (license management, DRM workflows, passphrase, licensing service)
• Navigator (UI rendering: EPUB, PDF, CBZ, audio; preferences; input; decoration)
• TestApp/ – an example iOS application with MVC components that consumes these modules.
• Package manifests (Package.swift), Carthage and CocoaPods specs, plus build tools.
README for additional insights
• Lists the modules and which features each provides.
• Describes dependencies between modules (e.g. Navigator → Shared, Streamer, Internal; Streamer → Shared; OPDS → Shared; LCP → Shared).
• Mentions external frameworks (R2LCPClient, SQLite.swift, GCDWebServer).
• TestApp (iOS App)
• ReadiumShared (core toolkit: HTTPClient, ZIP, format sniffers, logging)
• ReadiumStreamer (publication parser)
• ReadiumOPDS (catalog parser)
• ReadiumLCP (DRM license management)
• ReadiumNavigator (UI rendering engine)
• Adapters: GCDWebServer adapter, LCPSQLite adapter
• External Services: SQLite database, HTTP server, R2LCPClient.framework
• TestApp → Navigator, OPDS, LCP, Streamer, Shared
• Navigator → Streamer (requests parsed publications)
• Navigator → Shared (logging, resource loading, HTTP client)
• Streamer → Shared (archive & format services, HTTP for webpub)
• OPDS → Shared (HTTP, XML parsing)
• LCP → Shared (crypto, network)
• Adapters → Shared (database via SQLite, HTTP server)
• LCP → Adapters (stores license in SQLite)
• TestApp → Adapters (starts local HTTP server for debugging)
c. Architectural patterns & principles:
• Layered architecture:
Shared (foundation) → Streamer/OPDS/LCP → Navigator → TestApp
• Adapter pattern: GCDWebServer and SQLite adapters implement abstract toolkit interfaces.
• Dependency injection: modules accept protocol-based clients (HTTPClient, Database).
• Modularity: each Readium library can be used independently.
d. Technologies & frameworks:
• Swift Package Manager / Carthage / CocoaPods
• Swift 5.10+ / iOS 13.4+
• Fuzi (XML) / ZIPFoundation / Minizip / CryptoSwift
• GCDWebServer / SQLite.swift / R2LCPClient