Accessibility role - iOS
On iOS, the accessibilityTraits
attribute is used to indicate an accessibility role. The UIAccessibilityTraits
structure contains all options, such as header
, button
, link
and image
, among others.
You can also combine multiple traits. For example, for a selected button you can can pass both traits as an array: [.button, .selected]
.
element.accessibilityTraits = .button
element.accessibilityTraits = .header
element.accessibilityTraits = .link
element.accessibilityTraits = .image
element.accessibilityTraits = [.button, .selected]