Repository navigation
v1.1.0
Release Notes — v1.1.0 (since v1.0.2)
Breaking Changes
EPUBReaderViewis now generic:EPUBReaderView<Overlay, TOCView>— the struct has two type parameters for the overlay and TOC view. Existing call sites using the default overlay/TOC compile without changes thanks to constrained extensions, but if you stored the type explicitly (e.g.var reader: EPUBReaderView) you'll need to update it.ReadingPreferences→EPUBReaderSwiftUIPreferences: The type is renamed. Apublic typealias ReadingPreferences = EPUBReaderSwiftUIPreferencesis provided for backward compatibility, but consider migrating.TableOfContentsView→DefaultEPUBReaderTOCView: Same treatment — typealias keeps old code compiling, but the canonical name changed.TOCRowremoved: The internalTOCRowhelper struct is eliminated; its logic is inlined intoDefaultEPUBReaderTOCView.loadEPUB(from:initialLocator:)→loadEPUB(source:initialLocator:): The view-model load method now takes anEPUBSourceenum instead of a rawURL. This is internal API but relevant if you subclassed or called the VM directly.
New Public API
| Symbol | Kind | Description |
|---|---|---|
EPUBSource |
enum |
.fileURL(URL) / .remoteURL(String, useCache:) — unified input for local and remote EPUBs. |
EPUBReaderOverlayContext |
struct |
Bundles all reader state & actions (title, author, currentLocator, showControls, fontSize, close(), showTableOfContents(), toggleControls(), goToProgression(_:)) for custom overlays. |
EPUBReaderTOCContext |
struct |
Bundles TOC state & actions (tableOfContents, currentLocator, navigateToLink(_:), dismiss()) for custom TOC views. |
DefaultEPUBReaderOverlay |
View |
The built-in overlay, now a standalone public view you can reuse or wrap. |
DefaultEPUBReaderTOCView |
View |
The built-in TOC, also extracted as a standalone public view. |
EPUBReaderSwiftUILocator |
typealias |
= Locator — lets consumers avoid import ReadiumShared. |
EPUBReaderSwiftUILink |
typealias |
= ReadiumShared.Link — same convenience. |
goToProgression(_:) |
VM method | Navigate to an arbitrary 0…1 overall progression. |
New Initializers on EPUBReaderView
All existing init(url:…) / init(remoteURL:…) / init(source:…) signatures still work unchanged (constrained extensions default Overlay and TOCView). New overloads add:
// Custom overlay only (default TOC)
init(source:…, overlay:)
init(remoteURL:…, overlay:)
init(url:…, overlay:)
// Custom overlay + custom TOC
init(source:…, overlay:, tocView:)
init(remoteURL:…, overlay:, tocView:)
init(url:…, overlay:, tocView:)Both overlay and tocView closures are @ViewBuilder and receive their respective context struct.
Other Changes
ReadiumSharedis re-exported (@_exported import) — consumers no longer need an explicitimport ReadiumSharedforLocator,Link, etc.loadingMessageis now@Publishedon the view model, so the loading screen shows "Downloading EPUB…" vs "Loading EPUB…" depending on the source.- Remote EPUB support baked into
EPUBReaderView— pass aremoteURL:string directly; the view handles download, caching, and error states internally (no more manualEPUBDownloaderdance required at the call site).
Migration Checklist
- Replace explicit
ReadingPreferenceswithEPUBReaderSwiftUIPreferences(or keep using the typealias). - Replace explicit
TableOfContentsView(tableOfContents:onSelectLink:)withDefaultEPUBReaderTOCView(context:)if you were constructing it manually. - If you want the old behavior with zero UI changes, no action needed — the default-overlay/default-TOC constrained extensions match the old signatures exactly.