Skip to content

refactor: replace the last foregroundColor, cornerRadius and overlay(_:alignment:) calls - #95

Merged
romchornyi merged 2 commits into
dashpay:masterfrom
romchornyi-pitcrew:fix/deprecated-swiftui-apis
Dec 4, 2026
Merged

romchornyi merged 2 commits into
dashpay:masterfrom
romchornyi-pitcrew:fix/deprecated-swiftui-apis

Conversation

@romchornyi-pitcrew

@romchornyi-pitcrew romchornyi-pitcrew commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Issue being fixed or feature implemented

Closes #28.

Most of the deprecated calls the issue counted were already replaced by later PRs. What was left on master:

API In the library In previews
.foregroundColor(_:) 2 (BottomSheet title and grabber) 11 (BottomSheet previews)
.cornerRadius(_:) 2 (BottomSheet grabber, SwitchView track) 1 (ScrollViewWithOnScrollChanged)
.overlay(_:alignment:) 0 1 (ScrollViewWithOnScrollChanged)

What was done?

  • .foregroundColor(x) → .foregroundStyle(Color.x).
  • .cornerRadius(r) → .clipShape(.rect(cornerRadius: r, style: .circular)), keeping the non-continuous corner. One visible change follows: the switch track sets a radius of 1000 to mean a capsule. .cornerRadius(1000) drew its ends slightly flattened, while .rect(cornerRadius:) caps the radius at half the height, so the ends are now half circles, like a system Toggle. The bottom sheet grabber differs only in anti-aliasing (at most 6/255 on its edge pixels).
  • .overlay(Text(…)) → .overlay { Text(…) }.

Sources/ now has no call to any of the three. None of the replaced foregroundColor calls sat in a Text concatenation.

How Has This Been Tested?

  • Whole suite on the iPhone 17 simulator, iOS 26.5; the build has no deprecation warning in Sources/; conventions.sh.
  • Snapshot references for the switch, MenuItem's switch accessory and the dark BottomSheet headers are re-recorded from the CI run, after comparing them pixel by pixel with the old ones: the switch ends and the grabber's edge pixels are the only differences.

Before / After

The switch states (on, off, disabled on, disabled off), from the snapshot references.

Before After
Light
Dark

Breaking Changes

None in the API. The switch track's ends are half circles instead of slightly flattened.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation

🤖 Generated with Claude Code

…_:alignment:) calls

foregroundStyle, clipShape(.rect(cornerRadius:style: .circular)) and the content-closure overlay, with the same look. Closes dashpay#28.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • 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.

Share

@romchornyi romchornyi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

✅ No blockers, nothing open — reviewed at d7ea13a83c

Level Verdict
1 · Idea ✅ valid The last deprecated calls #28 counted.
2 · Architecture ✅ right layer A mechanical swap to the current API at the same sites.
3 · Completeness ✅ complete At this head Sources/ has no .foregroundColor(, .cornerRadius( or .overlay(_:alignment:) call left (DashButton.Style.foregroundColor(isEnabled:) is the library's own method), and README.md and docs/ have none either.
4 · Code ✅ clean .clipShape(.rect(cornerRadius:style: .circular)) keeps the corner .cornerRadius drew, so the snapshots stay as they are; none of the replaced foregroundColor calls sits in a Text concatenation.

🤖 Reviewed with Claude Code

clipShape(.rect(cornerRadius:)) caps the radius at half the height, so the switch track's ends are half circles; cornerRadius(1000) flattened them. The bottom sheet grabber differs only in anti-aliasing. References from CI run 47328651003.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@romchornyi
romchornyi merged commit 821e70b into dashpay:master Dec 4, 2026
12 checks passed
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.

Move off foregroundColor / cornerRadius / overlay(_:alignment:), which are deprecated in a future SDK

2 participants