Repository navigation
fix(modifier): inject router into pushed destinations; add UI tests and size budget - #24
Merged
Merged
Conversation
…nd size budget - navigationRouter on a hand-built NavigationStack crashed pushed screens reading @Environment for the router (environment was applied inside the stack) - example app: cover, sheet-rejected-while-cover, maxDepth deep link, modifier tab - NavigationStackExampleUITests: 9 normal/boundary cases with screenshots - scripts/check-binary-size.sh: fail when the library adds > 80 KB to a release app - CI: Example UI Tests (newest iOS simulator, xcresult artifact) and Binary Size jobs
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.
Description
Replaces state-only assumptions with real UI evidence, and fixes the bug that evidence found.
Bug fixed —
View.navigationRouter(...)applied inside a hand-builtNavigationStack(the README "Attach to an existing NavigationStack" recipe): any pushed screen reading@Environment(AppRouter.self)crashed (EXC_BREAKPOINTinEnvironmentValues.subscript.getter, crash report captured by the UI test). Pushed destinations take their environment from the stack, not from the view declaringnavigationDestination. The modifier now injects the router into each destination. Sheets and covers already inherit it from the presenting view (verified by a UI test).BaseNavigationContainerwas never affected.UI tests (
NavigationStackExampleUITests, 9 cases, screenshot attached at each key step):sendpush, modifier recipe → pushed screen, modifier recipe → sheet.maxDepth30 and further push rejected,present(sheet:)rejected while a cover is shown.Binary size budget —
scripts/check-binary-size.shbuilds a release SwiftUI app with and without the library (-Osize, dead-stripped, stripped) and fails above 80 KB. Current cost: ~67 KB. Injecting the router into sheets/covers as well would have cost +16.6 KB for no behavior gain, so only destinations get it.CI — new
Example UI Tests(newest iOS simulator on the runner,.xcresultuploaded as artifact) andBinary Sizejobs.Types of changes
Checklist:
swift test).Verification (local)
swift test24/24,swiftlint --strictclean.