pointfreeco / swift-snapshot-testing

📸 Delightful Swift snapshot testing.

Home Page:https://www.pointfree.co/episodes/ep41-a-tour-of-snapshot-testing

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Trait Overrides support for iOS 17

AllDmeat opened this issue · comments

Describe the bug
We were using SnapshotTesting for testing Dynamic Type with views being autosized using systemLayoutSizeFitting. Similar strategy can be found at #727.

This year Apple updated trait system at iOS 17. You can learn more at WWDC'23 session Unleash the UIKit trait system.
Traits are now applied only after the view has been added to the view hierarchy, rather than before.

At the same time, the SnapshotTesting library continues to request the view size before it is added to the hierarchy. Because of these two behaviors, we have a conflict and cannot test Dynamic Type with autosizing views.

To Reproduce
SnapshotDemo.zip

Expected behavior
Size is being requested after the view is added to the view hierarchy and all traitOverrides are applied.

Environment

  • swift-snapshot-testing 1.14.2
  • Xcode 15.0.1
  • Swift 5.9
  • iOS 17