How does accessibilityTextContentType changes Texts in SwiftUI using VoiceOver

23 views Asked by At

The Text in Swift has the accessibilityTextContentType instance method. I can't seem to figure out or notice what it changes if I'm using my app with VoiceOver.

The documentation says:

Assistive technologies can use this property to choose an appropriate way to output the text. For example, when encountering a source coding context, VoiceOver could choose to speak all punctuation.

That's a lot of coulds and cans... Unfortunately, I could not come up with any text that resulted in different output in VoiceOver with different accessibility text content types.

For example, I tried these below, and many others, expecting a change:

Text("/home/user/documents/photos/2024/vacation/destination/").accessibilityTextContentType(.fileSystem)
Text("/home/user/documents/photos/2024/vacation/destination/").accessibilityTextContentType(.plain)

Text("void main(List<String> arguments) { print('Hello $args'); }").accessibilityTextContentType(.sourceCode)
Text("void main(List<String> arguments) { print('Hello $args'); }").accessibilityTextContentType(.plain)

I'd like to better understand how the accessibility content type changes the output of the text in assistive technologies, but so far, I could not even come up with a single example that resulted in a different output.

If you could enlighten me with some examples, or maybe point out what I'm doing wrong, that would be appreciated.

0

There are 0 answers