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

Implement Shimmer in SwiftUI

Open jeaniehuynh opened this issue 2 years ago • 1 comments

Platforms Impacted

  • [x] iOS
  • [ ] macOS

Description of changes

Implement ShimmerView and ShimmerLinesView in SwiftUI

Known Issues:

  1. The existing logic is off with the shimmer angle (even in the UIKit implementation, the angles vary between the views). The shimmerAngle token's comment says "Angle of the direction of the gradient, in radian. 0 means horizontal, Pi/2 means vertical," but the formula for radians is degrees * (pi/180), not -(pi/degrees) as it currently is. I will address this in a separate change. For now, the SwiftUI implementation uses the .topLeading and .bottomTrailing UnitPoints for the gradient.
  2. matchedGeometryEffect syncs views was able to sync shimmers between two identical views, but I was not able to find a way to synchronize shimmers between views that are not the same (i.e. two views that are the same size will be in sync, but different views may fall out of sync). This will need to be addressed.

Simulator Screen Recording - iPad Pro (12 9-inch) (5th generation) - 2022-08-12 at 02 25 51

Pull request checklist

This PR has considered:

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

jeaniehuynh avatar Aug 12 '22 09:08 jeaniehuynh

Can you grab a before/after binary size comparison?

huwilkes avatar Aug 12 '22 21:08 huwilkes

Can you grab a before/after binary size comparison?

Before: 34,391,068 bytes (34.8 MB on disk) After: 35,032,396 bytes (35.4 MB on disk)

jeaniehuynh avatar Aug 17 '22 17:08 jeaniehuynh

Can you grab a before/after binary size comparison?

Before: 34,391,068 bytes (34.8 MB on disk) After: 35,032,396 bytes (35.4 MB on disk)

That's quite the increase. Do you think you could get the after size without the new demo, so we can see how much just the new control is adding?

huwilkes avatar Aug 17 '22 17:08 huwilkes

Can you grab a before/after binary size comparison?

Before: 34,391,068 bytes (34.8 MB on disk) After: 35,032,396 bytes (35.4 MB on disk)

That's quite the increase. Do you think you could get the after size without the new demo, so we can see how much just the new control is adding?

Without the demo: 34,674,828 bytes (35.1 MB on disk)

jeaniehuynh avatar Aug 17 '22 19:08 jeaniehuynh

Can you grab a before/after binary size comparison?

Before: 34,391,068 bytes (34.8 MB on disk) After: 35,032,396 bytes (35.4 MB on disk)

That's quite the increase. Do you think you could get the after size without the new demo, so we can see how much just the new control is adding?

Without the demo: 34,674,828 bytes (35.1 MB on disk)

I think we're still gonna have problems pitching a 280kB size increase for this one component...

mischreiber avatar Aug 23 '22 21:08 mischreiber