fluentui-apple icon indicating copy to clipboard operation
fluentui-apple copied to clipboard

Binary reduction: remove `AttributedText` and unneeded `.modifyIf` statements

Open mischreiber opened this issue 2 years ago • 0 comments

Platforms Impacted

  • [x] iOS
  • [ ] macOS

Description of changes

WIP: Cleaning up some unneeded stuff in our SwiftUI components to reduce binary size a bit.

  • iOS 15 added AttributedString support to Text, so our custom AttributedText is no longer needed.
  • We do a little more modifyIf calling than is strictly necessary. Removing one in Avatar and another in ListItem.

Binary change

Total increase: 18,744 bytes Total decrease: -71,176 bytes

File Before After Delta
Total 31,061,888 bytes 31,009,456 bytes 🎉 -52,432 bytes
Full breakdown
File Before After Delta
Avatar.o 599,920 bytes 615,512 bytes ⚠️ 15,592 bytes
FluentNotification.o 698,656 bytes 700,312 bytes ⚠️ 1,656 bytes
IndeterminateProgressBar.o 233,584 bytes 235,080 bytes ⚠️ 1,496 bytes
AvatarModifiers.o 44,016 bytes 42,448 bytes 🎉 -1,568 bytes
SwiftUI+ViewModifiers.o 123,512 bytes 119,472 bytes 🎉 -4,040 bytes
ListItem.o 274,344 bytes 267,128 bytes 🎉 -7,216 bytes
__.SYMDEF 4,823,240 bytes 4,811,336 bytes 🎉 -11,904 bytes
UIKit+SwiftUI_interoperability.o 46,448 bytes 0 bytes 🎉 -46,448 bytes

Verification

Ongoing! Will post videos once validation is complete, and once I'm sure I won't be adding any more.

Visual Verification
Before After
Screenshot or description before this change Screenshot or description with this change

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 avatar Feb 10 '24 00:02 mischreiber