Please, don't use accessibility labels as ids for your UI tests. It can completely ruin the experience for VoiceOver users. There is actually an accessibility identifier property that you can use instead to uniquely identify your UI elements.

An app for booking flights has used the accessibility label property to uniquely identify elements, presumably for finding those elements on their UI tests. That means that VoiceOver will start reading something like “Plan underscore trip underscore ban underscore airport underscore description underscore label. Plan underscore trip underscore ban underscore origin underscore airport underscore gps underscore icon. Plan underscore trip underscore btn underscore airport underscore title underscore label”, instead of a more understandable sequence of labels, something like “From. London Gatwick”.

You may also find interesting...

An interesting speech attribute for attributed accessibility labels is accessibilitySpeechIPANotation that lets you specify how VoiceOver should pronounce a label with the International Phonetic Alphabet (IPA) notation. https://developer.apple.com/documentation/foundation/nsattributedstring/key/accessibilityspeechipanotation

Images that convey important information should have the .image accessibility trait and provide an alternative text in the accessibility label. "Image" will be added to VoiceOver's utterance and the user will be able to use Image Explorer. Image Explorer is fairly new, introduced just a couple years ago. But if you were appropriately configuring the image trait, users suddenly got this new functionality for free. Isn't that awesome? With VoiceOver on, open Image Explorer by swiping up in an image and double tapping. It lets users find people (with a basic description and positioning in the photo), objects or text in images, using on-device intelligence. It is very cool!

You can add an observer to listen for changes in the content size category, in case it is more convenient than overriding traitCollectionDidChange(_:).

Created in Swift with Ignite.

Supporting Swift for Swifts