Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set segment pill button corner radius #1963

Merged
merged 3 commits into from
Feb 3, 2024

Conversation

joannaquu
Copy link
Contributor

@joannaquu joannaquu commented Feb 1, 2024

Platforms Impacted

  • iOS
  • macOS

Description of changes

Currently, SegmentedControl sets the cornerRadius. On iOS, this trickles down to SegmentPillButton as well. This is not true on other platforms. To fix this, set the cornerRadius explicitly.

To avoid magic numbers, move SegmentedControl.Constants to SegmentedControlTokenSet and access the corner radius from there. While I'm here, remove selectionBarHeight since it's not being used anywhere.

Binary change

Total increase: 2,224 bytes
Total decrease: -1,600 bytes

File Before After Delta
Total 30,917,640 bytes 30,918,264 bytes ⚠️ 624 bytes
Full breakdown
File Before After Delta
SegmentedControlTokenSet.o 90,128 bytes 91,448 bytes ⚠️ 1,320 bytes
SegmentPillButton.o 90,648 bytes 91,552 bytes ⚠️ 904 bytes
FocusRingView.o 814,848 bytes 814,688 bytes 🎉 -160 bytes
__.SYMDEF 4,770,960 bytes 4,770,720 bytes 🎉 -240 bytes
SegmentedControl.o 333,384 bytes 332,184 bytes 🎉 -1,200 bytes

Verification

Visual Verification
Before After
before after

Pull request checklist

This PR has considered:

  • Light and Dark appearances
  • iOS supported versions (all major versions greater than or equal current target deployment version)
  • VoiceOver and Keyboard Accessibility
  • Internationalization and Right to Left layouts
  • Different resolutions (1x, 2x, 3x)
  • Size classes and window sizes (iPhone vs iPad, notched devices, multitasking, different window sizes, etc)
  • iPad Pointer interaction
  • SwiftUI consumption (validation or new demo scenarios needed)
  • Objective-C exposure (provide it only if needed)
Microsoft Reviewers: Open in CodeFlow

@joannaquu joannaquu requested a review from a team as a code owner February 1, 2024 23:41
Copy link
Contributor

@laminesm laminesm left a comment

Choose a reason for hiding this comment

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

Should we consider making this a constant token instead of using a magic number?

@joannaquu joannaquu merged commit 12c93a3 into microsoft:main Feb 3, 2024
6 checks passed
@joannaquu joannaquu deleted the joannaqu/segment-pill branch February 3, 2024 14:38
@mischreiber mischreiber mentioned this pull request Mar 6, 2024
12 tasks
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.

3 participants