Skip to content

fix(modifier): inject router into pushed destinations; add UI tests and size budget - #24

Merged
iletai merged 1 commit into
developfrom
test/ui-verification
Nov 2, 2026
Merged

iletai merged 1 commit into
developfrom
test/ui-verification

Conversation

@iletai

@iletai iletai commented Nov 2, 2026

Copy link
Copy Markdown
Owner

Description

Replaces state-only assumptions with real UI evidence, and fixes the bug that evidence found.

Bug fixed — View.navigationRouter(...) applied inside a hand-built NavigationStack (the README "Attach to an existing NavigationStack" recipe): any pushed screen reading @Environment(AppRouter.self) crashed (EXC_BREAKPOINT in EnvironmentValues.subscript.getter, crash report captured by the UI test). Pushed destinations take their environment from the stack, not from the view declaring navigationDestination. The modifier now injects the router into each destination. Sheets and covers already inherit it from the presenting view (verified by a UI test). BaseNavigationContainer was never affected.

UI tests (NavigationStackExampleUITests, 9 cases, screenshot attached at each key step):

  • Normal: push/pop/popToRoot, sheet hosting an independent child stack, full screen cover, background send push, modifier recipe → pushed screen, modifier recipe → sheet.
  • Boundary: 10 rapid identical pushes collapse to one screen, deep link of 35 routes truncated at maxDepth 30 and further push rejected, present(sheet:) rejected while a cover is shown.
  • Example app gained the buttons needed to reach these states (cover, deep link, modifier tab).

Binary size budget — scripts/check-binary-size.sh builds 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, .xcresult uploaded as artifact) and Binary Size jobs.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation / CI update

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed (swift test).

Verification (local)

  • UI tests: 9/9 on iOS 26.4 (iPhone 17 Pro) and 9/9 on iOS 18.0 (iPhone 16). Before the fix the modifier test failed with the crash above.
  • swift test 24/24, swiftlint --strict clean.
  • Not covered: iOS 17 runtime (not installed), macOS cover-as-sheet rendering (example app is iOS-only).

…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
Copilot AI balanced review requested due to automatic review settings November 2, 2026 15:46

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@iletai
iletai merged commit 804f8ad into develop Nov 2, 2026
9 checks passed
@iletai
iletai deleted the test/ui-verification branch November 2, 2026 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants