Skip to content

The performAsCurrent method is deprecated in iOS 17.0+. Consider using UITraitCollection.current = trait or wrapping the test logic in a closure that explicitly uses the trait collection. #16

@rismay

Description

@rismay

The performAsCurrent method is deprecated in iOS 17.0+. Consider using UITraitCollection.current = trait or wrapping the test logic in a closure that explicitly uses the trait collection.

      let previousTrait = UITraitCollection.current
      UITraitCollection.current = trait
      let expected = UIFontMetrics.default.scaledFont(for: baseFont, compatibleWith: trait)
      let result = FontMetrics.scaledFont(for: baseFont)
      #expect(result.pointSize == expected.pointSize)
      UITraitCollection.current = previousTrait

Originally posted by @Copilot in #13 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions