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

Update tokens to use UIKit types, part 2 #1655

Merged
merged 13 commits into from
Mar 21, 2023

Conversation

mischreiber
Copy link
Contributor

@mischreiber mischreiber commented Mar 20, 2023

Platforms Impacted

  • iOS
  • macOS

Description of changes

Three commits to bring our public token API fully to UIKit types.

  • 966cd48: This updates the last of our core types and APIs, including ControlTokenSet and GlobalTokens, to use UIKit.
    • Some cases, like GlobalTokens, will temporarily host two APIs - a legacy one using existing ColorValue/DynamicColor types, and a modern one that fully leverages UIKit types. This is mostly for high-traffic APIs that would be overly disruptive to change now.
    • Other cases, like ControlTokenSet, are being fully converted now. These are low-traffic APIs that would be difficult to maintain in two forms - fully converting now is the easiest path forward.
  • 79b822b: This converts all of our components to use the new APIs. There are still some lingering uses of ColorValue, DynamicColor, and FontInfo, but they will be fully removed for the 0.15 release cycle.
  • e27ed14: Updating our Demo app to use the new APIs. This appears highly disruptive for two reasons:
    • The demo app was already making heavy use of our WIP FluentTheme APIs, which have changed here. External clients had no access to the WIP APIs, so will not experience this disruption.
    • The demo app makes heavy use of ControlTokenSet customization for testing purposes. This is not yet the case for most of our clients, so the impact externally will be less severe.

Binary change

Total increase: 117,672 bytes
Total decrease: -178,400 bytes

File Before After Delta
Total 29,906,584 bytes 29,845,856 bytes 🎉 -60,728 bytes
Full breakdown
File Before After Delta
GlobalTokens.o 478,720 bytes 554,720 bytes 🛑 76,000 bytes
UIColor+Extensions.o 58,256 bytes 79,664 bytes ⚠️ 21,408 bytes
FluentTheme.o 116,592 bytes 123,688 bytes ⚠️ 7,096 bytes
FluentTheme+Tokens.o 59,248 bytes 61,560 bytes ⚠️ 2,312 bytes
DateTimePickerViewLayout.o 42,784 bytes 44,816 bytes ⚠️ 2,032 bytes
__.SYMDEF 4,599,632 bytes 4,601,488 bytes ⚠️ 1,856 bytes
DrawerController.o 492,008 bytes 493,392 bytes ⚠️ 1,384 bytes
AliasTokens.o 200,168 bytes 201,304 bytes ⚠️ 1,136 bytes
DateTimePickerViewComponentTableView.o 69,832 bytes 70,752 bytes ⚠️ 920 bytes
SegmentedControlTokenSet.o 92,848 bytes 93,720 bytes ⚠️ 872 bytes
ColorProviding.o 37,296 bytes 37,968 bytes ⚠️ 672 bytes
BadgeLabel.o 55,352 bytes 55,976 bytes ⚠️ 624 bytes
DateTimePickerViewComponent.o 144,288 bytes 144,848 bytes ⚠️ 560 bytes
BottomSheetTokenSet.o 49,344 bytes 49,744 bytes ⚠️ 400 bytes
BadgeField.o 539,384 bytes 539,768 bytes ⚠️ 384 bytes
FontInfo.o 63,944 bytes 63,952 bytes ⚠️ 8 bytes
ShyHeaderController.o 251,080 bytes 251,088 bytes ⚠️ 8 bytes
PersonaButtonCarouselTokenSet.o 43,928 bytes 43,888 bytes 🎉 -40 bytes
IndeterminateProgressBarTokenSet.o 45,888 bytes 45,840 bytes 🎉 -48 bytes
TooltipTokenSet.o 59,616 bytes 59,560 bytes 🎉 -56 bytes
DynamicColor.o 51,712 bytes 51,648 bytes 🎉 -64 bytes
PersonaButtonTokenSet.o 68,888 bytes 68,808 bytes 🎉 -80 bytes
CardNudgeTokenSet.o 88,168 bytes 88,000 bytes 🎉 -168 bytes
TextFieldTokenSet.o 95,432 bytes 95,168 bytes 🎉 -264 bytes
PeoplePicker.o 294,224 bytes 293,952 bytes 🎉 -272 bytes
String+Extension.o 57,912 bytes 57,616 bytes 🎉 -296 bytes
UIView+Extensions.o 74,360 bytes 74,040 bytes 🎉 -320 bytes
DatePickerController.o 354,640 bytes 354,160 bytes 🎉 -480 bytes
BadgeLabelButton.o 860,640 bytes 860,136 bytes 🎉 -504 bytes
ActivityIndicatorTokenSet.o 67,400 bytes 66,816 bytes 🎉 -584 bytes
LargeTitleView.o 162,272 bytes 161,672 bytes 🎉 -600 bytes
TableViewCellFileAccessoryView.o 332,296 bytes 331,656 bytes 🎉 -640 bytes
HeadsUpDisplayTokenSet.o 57,664 bytes 56,984 bytes 🎉 -680 bytes
ShimmerLinesView.o 242,248 bytes 241,552 bytes 🎉 -696 bytes
ResizingHandleView.o 52,320 bytes 51,608 bytes 🎉 -712 bytes
TableViewHeaderFooterView.o 286,256 bytes 285,504 bytes 🎉 -752 bytes
BooleanCell.o 94,296 bytes 93,464 bytes 🎉 -832 bytes
CommandBarTokenSet.o 68,696 bytes 67,864 bytes 🎉 -832 bytes
PersonaListView.o 186,640 bytes 185,800 bytes 🎉 -840 bytes
ShadowInfo.o 54,600 bytes 53,752 bytes 🎉 -848 bytes
CalendarView.o 73,832 bytes 72,976 bytes 🎉 -856 bytes
CalendarViewDayTodayCell.o 37,744 bytes 36,880 bytes 🎉 -864 bytes
CommandBarButton.o 108,376 bytes 107,400 bytes 🎉 -976 bytes
PillButton.o 197,624 bytes 196,648 bytes 🎉 -976 bytes
TableViewCellTokenSet.o 115,760 bytes 114,728 bytes 🎉 -1,032 bytes
Separator.o 57,560 bytes 56,528 bytes 🎉 -1,032 bytes
BottomSheetController.o 506,696 bytes 505,640 bytes 🎉 -1,056 bytes
ShimmerView.o 169,736 bytes 168,680 bytes 🎉 -1,056 bytes
TabBarItemView.o 215,608 bytes 214,504 bytes 🎉 -1,104 bytes
PopupMenuItem.o 114,792 bytes 113,648 bytes 🎉 -1,144 bytes
CalendarViewDayMonthYearCell.o 46,880 bytes 45,720 bytes 🎉 -1,160 bytes
NavigationBar.o 553,928 bytes 552,720 bytes 🎉 -1,208 bytes
NotificationTokenSet.o 95,968 bytes 94,752 bytes 🎉 -1,216 bytes
CalendarViewDayMonthCell.o 43,328 bytes 41,992 bytes 🎉 -1,336 bytes
TwoLineTitleView.o 211,200 bytes 209,840 bytes 🎉 -1,360 bytes
PersonaButtonCarousel.o 198,144 bytes 196,776 bytes 🎉 -1,368 bytes
BadgeView.o 424,440 bytes 423,056 bytes 🎉 -1,384 bytes
SegmentedControl.o 325,528 bytes 324,144 bytes 🎉 -1,384 bytes
ActivityIndicator.o 198,432 bytes 196,936 bytes 🎉 -1,496 bytes
CalendarViewDayCell.o 148,056 bytes 146,520 bytes 🎉 -1,536 bytes
PopupMenuItemCell.o 166,408 bytes 164,808 bytes 🎉 -1,600 bytes
IndeterminateProgressBar.o 280,176 bytes 278,496 bytes 🎉 -1,680 bytes
MSFAvatarPresence.o 45,528 bytes 43,840 bytes 🎉 -1,688 bytes
SearchBar.o 445,112 bytes 443,296 bytes 🎉 -1,816 bytes
FluentUIFramework.o 78,512 bytes 76,392 bytes 🎉 -2,120 bytes
ControlTokenSet.o 85,936 bytes 83,800 bytes 🎉 -2,136 bytes
FluentTextField.o 205,912 bytes 203,712 bytes 🎉 -2,200 bytes
CardView.o 277,784 bytes 275,544 bytes 🎉 -2,240 bytes
LinearGradientInfo.o 89,848 bytes 87,520 bytes 🎉 -2,328 bytes
DateTimePickerView.o 277,344 bytes 275,000 bytes 🎉 -2,344 bytes
PopupMenuController.o 365,720 bytes 363,360 bytes 🎉 -2,360 bytes
HeadsUpDisplay.o 289,008 bytes 286,520 bytes 🎉 -2,488 bytes
SwiftUI+ViewModifiers.o 203,712 bytes 201,200 bytes 🎉 -2,512 bytes
ShimmerTokenSet.o 78,856 bytes 76,288 bytes 🎉 -2,568 bytes
Label.o 113,320 bytes 110,520 bytes 🎉 -2,800 bytes
ActionsCell.o 207,504 bytes 204,104 bytes 🎉 -3,400 bytes
CenteredLabelCell.o 89,016 bytes 85,528 bytes 🎉 -3,488 bytes
SegmentPillButton.o 90,968 bytes 87,464 bytes 🎉 -3,504 bytes
PillButtonStyle.o 62,264 bytes 58,728 bytes 🎉 -3,536 bytes
BottomCommandingController.o 741,592 bytes 738,040 bytes 🎉 -3,552 bytes
AvatarTokenSet.o 127,872 bytes 124,136 bytes 🎉 -3,736 bytes
LabelTokenSet.o 65,528 bytes 61,536 bytes 🎉 -3,992 bytes
DateTimePickerViewComponentCell.o 58,320 bytes 54,088 bytes 🎉 -4,232 bytes
Button.o 187,968 bytes 183,288 bytes 🎉 -4,680 bytes
ButtonTokenSet.o 119,520 bytes 114,248 bytes 🎉 -5,272 bytes
PersonaButton.o 278,056 bytes 272,040 bytes 🎉 -6,016 bytes
DateTimePickerController.o 165,272 bytes 158,992 bytes 🎉 -6,280 bytes
TooltipView.o 210,040 bytes 203,560 bytes 🎉 -6,480 bytes
Avatar.o 593,392 bytes 585,392 bytes 🎉 -8,000 bytes
FluentNotification.o 797,104 bytes 787,320 bytes 🎉 -9,784 bytes
TableViewCell.o 825,296 bytes 814,432 bytes 🎉 -10,864 bytes
CardNudge.o 452,400 bytes 441,264 bytes 🎉 -11,136 bytes
CalendarViewWeekdayHeadingView.o 104,912 bytes 91,496 bytes 🎉 -13,416 bytes

Verification

Two approaches:

  • Standard visual verification (see video below). No functional changes to any tested component.
  • Initial verification of integration into key downstream clients. The transition from 0.13 to 0.14 appears fairly straightforward, as hoped.
Visual Verification
UIKit-Tokens.mp4

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

@mischreiber mischreiber requested a review from a team as a code owner March 20, 2023 18:22
@mischreiber
Copy link
Contributor Author

FYI, I'm aware that I have some lingering shouldResize changes around certain fonts. I'm working on a fix now.

@Saadnajmi
Copy link
Contributor

I guess this change will make a future of maybe-bringing-to-Appkit one day not so easy? Ah, well, probably the right trade off :)

@mischreiber
Copy link
Contributor Author

I guess this change will make a future of maybe-bringing-to-Appkit one day not so easy? Ah, well, probably the right trade off :)

@Saadnajmi Maybe a little, but that's far enough off that I agree it's the right trade-off. And this pattern will be easier for AppKit consumers to use as well!

@mischreiber mischreiber enabled auto-merge (squash) March 21, 2023 18:03
@mischreiber mischreiber requested a review from a team as a code owner March 21, 2023 20:01
@mischreiber mischreiber merged commit 37098e7 into microsoft:main Mar 21, 2023
@mischreiber mischreiber deleted the mischreiber/uikit-tokens branch March 21, 2023 22:44
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.

6 participants