Repository navigation
Conversation
The central slot was overlaid at full width, so a long single-line title truncated at the bar's edges and drew over the back/close or trailing circles. The bar now measures both side slots and insets the central one on both sides by the wider of them, plus the edge padding and a 10pt gap, keeping the title centered. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
romchornyi-pitcrew
left a comment
There was a problem hiding this comment.
🟡 3 major · 6 non-blocking recommendations · no code blockers, reviewed at 4b4274fdda
| Level | Verdict | |
|---|---|---|
| 1 · Idea | ✅ valid | Long titles really do wrap and run under the circle buttons. Fixing it in the bar is better than each host padding by hand |
| 2 · Architecture | ✅ right layer | It belongs in NavigationBar |
| 3 · Completeness | 🟡 untracked gaps | No snapshot or preview of the new state. One app host stacks its own padding on top of the new inset |
| 4 · Code | 🟡 3 major | Repo rules (Before / After, snapshot) and how the side slots are measured |
Major
- Before / After screenshots. The PR changes
Sources/, but the description has no light and dark Before / After images and doesn't tick "No visual change". TheBefore / After screenshotscheck is red. The template's Breaking Changes and Checklist sections are missing as well. - No snapshot for the new state (
NavigationBarSnapshotTests).testVariantsand the previews render only the short "Title". That fits inside the inset, so the snapshot check passes without testing the change. The repo asks for a snapshot and a preview for every new visual state. Worth covering: a long title truncating, a bar with only a back button, and a central-only bar. - A side slot with several views is measured as its widest view (
NavigationBar.swift#L42,#L47,#L80-L92). With two views in the builder, the slot is aTupleView, and.background(reader)lands on each child separately.reducethen keeps the max, not the total. For example,trailing: { NavigationBarCircleButton(…); NavigationBarCircleMenu(…) }reports 34pt instead of about 78pt, and a long title runs under the first button, which is the bug this PR fixes. No current host does this, so it's latent. Measuring each slot as one row (HStack(spacing: 0) { leading }before the reader) closes it. (traced in code, not run)
6 non-blocking recommendations
- The inset has no upper bound (
#L62-L67). With a wide side slot (a text button plus a menu),2 × insetcan pass the bar's width: the title gets a lone "…", and the padded view grows past the bar. Clamp the inset, or keep a minimum title width. (not verified) - First frame.
leadingWidth/trailingWidthstart at 0, so the first layout uses the 20pt inset, and the title truncates again once the preferences arrive. That can show as a jump during a push, or when a side control appears insidewithAnimation. There's no feedback loop: the sides never depend on the inset. (not verified on a device) - Altitude / reuse. With the iOS 18 floor, a small custom
Layoutcould place the three slots in one pass. That removes the state round trip behind points 1 and 2. Short of that,onGeometryChange(or the package'sreadingFrame) replaces the reader view and the two identical PreferenceKeys. - A central-only bar now gets a 20pt inset (
#L65). Before, the central slot spanned the full width. Content that pads itself (a search field, a segmented control) ends up 40pt narrower. - Docs (
navigation-and-containers.md#L14-L17). "Always one line" is a default, not a guarantee: a host's own.lineLimit(2)still wins, and non-Text content is only offered less width. "One line by default" plus a sentence on non-Text content would be accurate. - App follow-up. In dashwallet-ios,
WalletAccountsScreen.swift#L97-L103pads its central title by 60pt itself. With this change the two insets add up to about 124pt per side, and a wallet name like "Main wallet (imported 2024)" truncates where it used to fit. That padding should go when the app picks up this version. The merchant-details wrapper the description mentions isn't on the app's develop branch yet.
Review details
- Layered review: idea → architecture → completeness → code.
- Code level: the general lane (
/code-review high) plus a UI lane covering hosts in this package and in dashwallet-ios, Dynamic Type, VoiceOver, RTL, snapshots and docs. - Verifier: the slot-measurement finding was confirmed independently by both lanes.
- Checked with no finding: RTL, Dynamic Type (bar fonts don't scale), VoiceOver (it reads the full title), the Home logo, and the other app hosts.
- Nothing was run on a device.
🤖 Reviewed with Claude Code
… row A small Layout places the three slots, replacing the width preferences: - a slot with several views is measured as one row, not as its widest view; - the title gets its inset in the first layout pass, with no jump once measurements arrive; - side slots wider than the bar leave the title no room instead of pushing it past the bar's edges; - with no side slots the central slot spans the full width again. Adds a long-title snapshot (both sides, back only, two views in one slot, no sides) and preview, and says "one line by default" in the docs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for the review. Addressed in aca5caf (merged with master in fc60924): Major
Recommendations
Not verified: right-to-left. A custom 🤖 Generated with Claude Code |
romchornyi-pitcrew
left a comment
There was a problem hiding this comment.
🟡 1 major (inline) · 3 non-blocking recommendations · no code blockers, re-reviewed at fc609246cf (delta since 4b4274fdda)
| Level | Verdict | |
|---|---|---|
| 1 · Idea | ✅ valid | unchanged |
| 2 · Architecture | ✅ right layer | the bar now lays its three slots out in one pass with a private Layout (NavigationBar.swift#L57) |
| 3 · Completeness | 🟡 untracked gaps | testLongTitles and a preview cover every new state, but their snapshot references are not committed, so the snapshot job is red |
| 4 · Code | ✅ clean | slots measured as rows, the inset clamped, no state round trip |
Closed since the last review
- Major: a slot with several views measured as its widest view. Each slot is wrapped in one
HStackbefore the layout reads it (#L39-L49), so two buttons count as their combined width.testLongTitlesdraws exactly that case. - Major: Before / After screenshots. Light and dark comparisons are in the description; the check is green.
- Rec 1, no upper bound on the inset. The central width is clamped at zero (
#L105). - Rec 2, first frame. Gone with the
Layout: no measured widths in@State, no preference keys. - Rec 3, altitude. Done as suggested.
- Rec 4, central-only bar. No side slots give an inset of 0 (
#L96-L100), so the central slot spans the full width as before. - Rec 5, docs. "One line by default", the host's
.lineLimitand non-Text content are all described.
Major (inline)
- The
testLongTitlesreferences are missing —NavigationBarSnapshotTests.swift#L80— CI fails with "No reference was found on disk" forlong-titles-lightandlong-titles-dark.testVariantspasses unchanged, which also shows short titles lay out exactly as before. Fetching the two references the job recorded (.github/scripts/fetch-snapshots.sh), checking them by eye and committing them turns the job green.
3 non-blocking recommendations
- App follow-up, unchanged —
WalletAccountsScreen.swift#L97-L103still pads its central title by 60pt itself; it should drop that padding when the app takes this version. - RTL — the layout places the leading slot at
bounds.minXwith a.leadinganchor. SwiftUI mirrors a customLayoutin a right-to-left environment, so the back button should still land on the right; a quick RTL preview would confirm it. (not verified) - PR description — the template's Breaking Changes and Checklist sections are still missing. "None" is the honest Breaking Changes answer: the public initialisers are unchanged.
Review details
- Re-review of the delta
4b4274fdda..fc609246cf(aca5cafplus a merge of master), against the findings of the previous review. - Levels: idea → architecture → completeness → code. Static read; the snapshot job's log was read for the failure.
- Checked with no finding: an omitted slot (an empty
HStack, width 0), the central slot's height and vertical centring, the 74pt minimum height, VoiceOver order (now leading, central, trailing), a host's own.lineLimit. - Nothing was run on a device.
🤖 Reviewed with Claude Code
| ) | ||
| NavigationBar(central: { longTitle() }) | ||
| } | ||
| try assertComponentSnapshots(of: view, named: "long-titles") |
There was a problem hiding this comment.
Major: no reference for this snapshot. The snapshot job fails here with "No reference was found on disk" for long-titles-light and long-titles-dark. Fetch the references the job recorded with .github/scripts/fetch-snapshots.sh, check them by eye (a tail ellipsis clear of the wider side in the first three bars, full width in the last) and commit them.
What
NavigationBarnow keeps the central title clear of the side controls and on a single line:.lineLimit(1).truncationMode(.tail)— a title that does not fit ends in an ellipsis instead of wrapping or running under the back/close circle.docs/navigation-and-containers.mddescribes the behaviour.Before / After
Why
Long titles (e.g. merchant names on the Explore details screen in dashwallet-ios) wrapped to two lines and ran under the circle buttons. The app worked around it with a hard-coded horizontal padding in its own wrapper; with this change the wrapper can drop it.
Testing
Checked in dashwallet-ios on the merchant details screen with the longest name in the Explore database: the title shows as one line ending in "…", clear of the back button. Short titles are unchanged and centred.
🤖 Generated with Claude Code