Skip to content

v1.1.0

Choose a tag to compare

@jtCodes jtCodes released this 11 Apr 03:22
· 13 commits to main since this release
58efa0a

Release Notes — v1.1.0 (since v1.0.2)

Breaking Changes

  • EPUBReaderView is 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. A public typealias ReadingPreferences = EPUBReaderSwiftUIPreferences is provided for backward compatibility, but consider migrating.
  • TableOfContentsView → DefaultEPUBReaderTOCView: Same treatment — typealias keeps old code compiling, but the canonical name changed.
  • TOCRow removed: The internal TOCRow helper struct is eliminated; its logic is inlined into DefaultEPUBReaderTOCView.
  • loadEPUB(from:initialLocator:) → loadEPUB(source:initialLocator:): The view-model load method now takes an EPUBSource enum instead of a raw URL. 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

  • ReadiumShared is re-exported (@_exported import) — consumers no longer need an explicit import ReadiumShared for Locator, Link, etc.
  • loadingMessage is now @Published on the view model, so the loading screen shows "Downloading EPUB…" vs "Loading EPUB…" depending on the source.
  • Remote EPUB support baked into EPUBReaderView — pass a remoteURL: string directly; the view handles download, caching, and error states internally (no more manual EPUBDownloader dance required at the call site).

Migration Checklist

  1. Replace explicit ReadingPreferences with EPUBReaderSwiftUIPreferences (or keep using the typealias).
  2. Replace explicit TableOfContentsView(tableOfContents:onSelectLink:) with DefaultEPUBReaderTOCView(context:) if you were constructing it manually.
  3. 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.