Instance Method

hasDifferentColorAppearance(comparedTo:)

Returns a Boolean value indicating whether changing between the specified and current trait collections would affect color values.

Declaration

func hasDifferentColorAppearance(comparedTo traitCollection: UITraitCollection?) -> Bool

Parameters

traitCollection

A trait collection that you want to compare to the current trait collection.

Return Value

true if the colors in the two trait collections differ, or false if they have the same component values.

Discussion

Use this method to determine whether changing the traits of the current environment would also change the colors in your interface. For example, changing the userInterfaceStyle or accessibilityContrast property usually changes the colors of your interface.

See Also

Comparing Trait Collections

func containsTraits(in: UITraitCollection?) -> Bool

Returns a Boolean value that indicates whether a trait collection contains all of another trait collection’s values.