-
Notifications
You must be signed in to change notification settings - Fork 178
New navigator content inset strategy #662
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new delegate method for customizing content insets in navigators to prevent layout shifts when system UI (like the status bar) changes visibility. The implementation allows applications to provide stable insets that don't change with safe area updates.
Key Changes:
- Added
VisualNavigatorDelegate.navigatorContentInset(_:)delegate method to customize content and safe-area insets - Changed
EPUBNavigatorViewController.Configuration.contentInsetto expect values that include safe area insets (breaking change) - Refactored internal inset calculation logic across PDF and EPUB navigators to use the new delegate method
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
Sources/Navigator/VisualNavigator.swift |
Added new delegate method navigatorContentInset(_:) with default implementation returning nil |
Sources/Navigator/PDF/PDFNavigatorViewController.swift |
Implemented PDFDocumentViewDelegate to forward content inset requests to the navigator delegate |
Sources/Navigator/PDF/PDFDocumentView.swift |
Added delegate protocol and updated inset calculation to use delegate method |
Sources/Navigator/EPUB/EPUBSpreadView.swift |
Added delegate method signature for spread view content inset |
Sources/Navigator/EPUB/EPUBReflowableSpreadView.swift |
Simplified inset calculation to use delegate-provided values |
Sources/Navigator/EPUB/EPUBNavigatorViewController.swift |
Implemented spread view delegate method with fallback logic and updated default configuration values |
Sources/Navigator/EPUB/EPUBFixedSpreadView.swift |
Updated to use delegate-provided insets |
CHANGELOG.md |
Documented the new feature and breaking change |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
10bd1c5 to
193ba01
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Added
Navigator
VisualNavigatorDelegate.navigatorContentInset(_:)to customize the content and safe-area insets used by the navigator.safeAreaInsets, which can cause content to shift when the status bar is shown or hidden (since those insets change). To avoid this, implementnavigatorContentInset(_:)and return insets that remain stable across status bar visibility changes — for example, a top inset large enough to accommodate the maximum expected status bar height.Changed
Navigator
EPUBNavigatorViewController.Configuration.contentInsetnow expects values that already include the safe area insets.VisualNavigatorDelegate.navigatorContentInset(_:)to compute and return the full insets (content + safe area), helping avoid layout shifts when system UI (e.g., the status bar) appears or disappears.