New navigator content inset strategy#662
Merged
mickael-menu merged 2 commits intodevelopfrom Oct 27, 2025
Merged
Conversation
There was a problem hiding this comment.
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.
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.