Repository navigation
refactor: move off deprecated foregroundColor, cornerRadius and overlay(_:alignment:) - #43
Conversation
foregroundColor(_:) is deprecated in a future SDK. Implicit members are spelled out where foregroundStyle's generic ShapeStyle parameter would change their meaning: .secondary becomes Color.secondary (not the hierarchical style) and .dash.x becomes Color.dash.x. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…Radius cornerRadius(_:) is deprecated in a future SDK. Its inlinable body is clipShape(RoundedRectangle(cornerRadius:), style: FillStyle(antialiased: true)); .rect(cornerRadius:) is the same RoundedRectangle with the same default corner style, so the corner does not change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
overlay(_:alignment:) is deprecated in a future SDK, also when called without alignment: (it defaults to .center). overlay(alignment:content:) builds the same _OverlayModifier. ShapeStyle overlays are a different, non-deprecated overload; none are touched here. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Package-wide modifier updates Sources/DashUIKit/Button/*, Sources/DashUIKit/Components/*, Sources/DashUIKit/Foundation/*, Sources/DashUIKit/Table List/*, README.md, docs/* |
Views, previews, and examples use foregroundStyle in place of foregroundColor. Selected overlays use trailing-closure syntax, and selected rounded corners use clipShape. Existing color values, conditions, and layout values remain unchanged. |
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Refactor
Possibly related issues
- DashUIKit issue 28 requests the same modifier replacements across
Sources/. This pull request performs those replacements across the package; the issue’s notes aboutTextconcatenation and continuous corner style are not covered in the supplied change details.
Possibly related PRs
- dashpay/DashUIKit#15: This pull request uses newer SwiftUI modifier forms after the package floor update and does not add older-platform branches.
- dashpay/DashUIKit#31: This pull request continues the
foregroundStylemigration in DashUIKit views.
Suggested reviewers: jeanpierreroma, romchornyi-pitcrew
Merge Risk: 
Minimal · up to 7c89a
-
The modifier migration has no identified merge-blocking issue and appears ready to merge subject to normal checks.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passedFull details: Docstring Coverage
-
Explanation
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 4 functions across 29 files. (3 skipped: 3 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches
-
Generate docstrings
-
- Commit to this branch
- Create a new PR
Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
romchornyi-pitcrew
left a comment
There was a problem hiding this comment.
✅ no blockers · no majors · 7 non-blocking recommendations — reviewed at 3b02962688
| Level | Verdict | |
|---|---|---|
| 1 · Idea | ✅ valid | Part of #28: moves Sources/ off three SwiftUI APIs the SDK marks for deprecation, before they start warning |
| 2 · Architecture | ✅ right layer | A mechanical sweep inside the library. The public API is unchanged (api-check.sh) |
| 3 · Completeness | ✅ gaps tracked | At this head, no .foregroundColor( / .cornerRadius( / view-value .overlay( is left in Sources/ outside the five files the description defers to the open PRs that edit them (#24, #27, #31, #32), and #28 tracks those. The two foregroundColor matches left are DashButtonStyle.foregroundColor(isEnabled:), the internal method |
| 4 · Code | ✅ clean | Each swap builds the same view: the same _OverlayModifier, the same RoundedRectangle clip, and implicit members spelled out (Color.secondary, Color.dash.x, Color.clear) so none turns into a hierarchical style. 217 of 220 renders are byte-identical, and the 3 others are animation phase |
7 non-blocking recommendations
- A CI guard for the three idioms now — the SDK does not warn yet, so any PR merged after this one can bring
.foregroundColor(.dash.x)back with CI green. Aconventions.shrule with a temporary exclusion list for the four deferred files would stop the drift today, instead of after the follow-up. - Possible colour animation in
SwapAmountView— and — the row colours moved from theforegroundColorenvironment toforegroundStyle, which may interpolate when it changes inside an animated transaction. The swap'sonChangeassumes "font/color snaps to target". The still-frame pixel check cannot see this. Worth one look withisPrimaryLargetoggled insidewithAnimation. (not verified) strokeGrayfill narrower than its outline ——DashUIKit/Sources/DashUIKit/Button/DashButton.swift
Lines 186 to 194 in 3b02962
.background/.clipShapecome before.frame(maxWidth:), while the stroke overlay comes after it. A disabled full-widthstrokeGrayshows a narrow gray pill inside a wide outline. This predates the PR, and the description already notes it. It needs its own issue, since the fix is a visual change. (order verified at this head)- Corner styles do not match —
and
— the stroke overlays use the default
.circularRoundedRectangle, while the fill is clipped with.continuous(andAddressFieldView's focus ring is.continuoustoo). At larger radii the stroke and the fill meet unevenly at the corners. This also predates the PR. (not verified visually) - The same hunk keeps view-value
.background(_:alignment:)— — the description already notes that this form is deprecated the same way. Since this PR rewrites that chain anyway,.background(…, in: RoundedRectangle(…))here would avoid another sweep of the same lines. - Plain styles have no tap shape — — styles with a
DashUIKit/Sources/DashUIKit/Button/DashButton.swift
Lines 196 to 202 in 3b02962
.clearbackground have nocontentShapeunder.buttonStyle(.plain), so the padding and the full-width area cannot be tapped.SimpleSelectalready notes this trap. Not from this PR. (not verified at runtime) ThumbViewas a capsule — — a clearRectangleplus background plus a 1000pt radius clip is a capsule in four steps.Capsule().fill(…)gives the same pixels. A preview-only nit in the same file set:Color.secondaryinDashButton's previews (lines 285, 303) is a system colour where the rest of the diff usesColor.dash.secondaryText.
Review details
Tier: normal (a mechanical refactor across 32 files). Levels 1–3 inline. For completeness, the head was grepped for the three idioms and for implicit-member traps. Level 4 used the general lane (/code-review high), which traced the swaps for equivalence. The verifier read the DashButton branch order and SimpleSelect's background at this head. Items 3, 4 and 6 predate the PR and are listed because they sit in the touched hunks. CI was green at this head.
🤖 Reviewed with Claude Code
|
@coderabbitai review |
Action performed
|
Issue being fixed or feature implemented
Part of #28.
Sources/still uses three SwiftUI APIs that the SDK marksdeprecated: 100000.0(deprecated in a future version, so no warning yet):foregroundColor(_:),cornerRadius(_:)andoverlay(_:alignment:)with a view. This PR moves every use off them, except in five files that other open PRs are changing right now (see "Follow-up" below).What was done?
One commit per idiom, plus one for the docs:
.foregroundColor(x)→.foregroundStyle(x)(78 call sites in 26 files).foregroundStyletakes a genericShapeStyle, so implicit members are spelled out where their meaning would change:.secondary→Color.secondary. A bare.secondarywould become the hierarchical style..dash.x→Color.dash.x, because.dashdoes not resolve onShapeStyle..clear→Color.clear.No call passes an optional color, and nothing concatenates
Text.DashButtonStyle.foregroundColor(isEnabled:)is an internal method, not the modifier, and is unchanged..cornerRadius(r)→.clipShape(.rect(cornerRadius: r))(ThumbView,FrameReaderpreview). The SDK's inlinable body ofcornerRadiusisclipShape(RoundedRectangle(cornerRadius: r), style: FillStyle(antialiased: true))..rect(cornerRadius:)is the sameRoundedRectanglewith the same default corner style, andFillStyle()is antialiased, so the expression is the same. No explicitstyle:is passed, on purpose..overlay(view[, alignment: a])→.overlay(alignment: a) { view }(11 sites inDashButton,AddressFieldView,NavigationBarCircleIcon,SimpleSelect,ConverterCard,ConverterArrowBadge, plus theSheetFeatureandFrameReaderpreviews). The value form is deprecated even withoutalignment:, because that parameter just defaults to.center. Both forms build the same_OverlayModifier. ShapeStyle overlays are a separate overload that is not deprecated; none are touched.Docs: the
README.md,docs/foundation.mdanddocs/navigation-and-containers.mdexamples use.foregroundStyle(Color.dash.primaryText).No visual change: every replacement builds the same view (pixel check below).
Follow-up (not in this PR)
These files are left untouched because open PRs are editing them. They get the same sweep after those PRs merge:
BottomSheet/BottomSheet.swift.foregroundColor(.dash.…)/.foregroundColor(.clear), 1×.cornerRadius(5)Switch/SwitchView.swift.cornerRadius(Constants.switchTrackRadius)Geometry/ScrollViewWithOnScrollChanged.swift.cornerRadius(10),.overlay(Text("Row \(index)"))Geometry/LocationReader.swift.cornerRadius(10), 1×.overlay(Text(…))SearchBar.swiftA
conventions.shrule against these idioms would go in with that follow-up, so it lands with no exclusion list.Also found, outside #28's three APIs:
background(_:alignment:)with a view value is deprecated the same way, and is used in about 10 places.DashButton'sstrokeGraybranch applies.background/.clipShapebefore.frame(maxWidth:), while its stroke overlay comes after the frame. So a disabled full-width strokeGray button would draw its gray fill narrower than its outline. This is from reading the code and predates this PR; it would be a visual change, so it is not fixed here.How Has This Been Tested?
swift build(macOS) and the iOS Release device build (generic/platform=iOS) are clean, with no warnings. The unit tests pass in CI ("Unit tests (iOS Simulator)"); the local simulator run did not finish because the machine was overloaded.conventions.shpasses (161 imagesets, 162 colorsets).api-check.shon a squash of this branch ontomaster: "No breaking changes detected in DashUIKit".PreviewRegistry/PreviewProviderconformance records, so it renders every#PreviewandPreviewProviderin the package as written. That is 108 previews, plusTopIntroView, which has no preview. Each was rendered in light and dark, at 3×, on the iOS 27 simulator, once onmaster(402db65) and once on this branch, and the PNGs were compared.Toast, inside theProgressViewspinner only (47×47 px)LoadingIllustration(animated)The three differences are animation phase, not this change. Two renders of
masterdiffer in the same 47×47 px box of theToastspinner, andLoadingIllustration.swiftis not touched.Before / After
Each replacement builds the same view: the same
_OverlayModifier, the sameRoundedRectangleclip, and the same color as the foreground style. 217 of 220 before/after renders are byte-identical, and the other 3 differ only in spinner/animation phase, which also differs between two runs ofmaster(see the table above).Breaking Changes
None. Public API is unchanged (
api-check.sh).Checklist:
🤖 Generated with Claude Code
Summary by CodeRabbit
Refactor
Documentation