Skip to main content

How to make VoiceOver read characters individually

About 2 minSwiftSwiftUIArticle(s)bloghackingwithswift.comcrashcourseswiftswiftuixcodeappstore

How to make VoiceOver read characters individually 관련

SwiftUI by Example

Back to Home

How to make VoiceOver read characters individually | SwiftUI by Example

How to make VoiceOver read characters individually

Updated for Xcode 15

Most text can be read as words, but some special text such as passwords, stock symbols, and certain numbers, must be read by VoiceOver letter by letter in order to be useful. In SwiftUI this can be enabled using the speechSpellsOutCharacters() modifier, which is used like this:

Text("abCayer-muQai")
    .speechSpellsOutCharacters()

This modifier returns another Text instance, which means you can chain it to other Text-only modifiers if you want.

It works particular well when grouping accessibility elements together so they are read as one, like this:

VStack {
    Text("Your password is")
    Text("abCayer-muQai")
        .font(.title)
        .speechSpellsOutCharacters()
}
.accessibilityElement(children: .combine)

Using that code, VoiceOver will automatically read “Your password is” naturally, then spell out the password part as requested.

Similar solutions…
How to create a picker and read values from it | SwiftUI by Example

How to create a picker and read values from it
How to read tap and double-tap gestures | SwiftUI by Example

How to read tap and double-tap gestures
How to create a segmented control and read values from it | SwiftUI by Example

How to create a segmented control and read values from it
How to create a stepper and read values from it | SwiftUI by Example

How to create a stepper and read values from it
How to create a slider and read values from it | SwiftUI by Example

How to create a slider and read values from it

이찬희 (MarkiiimarK)
Never Stop Learning.