MacOS – VoiceOver not reading ‘-‘ in Xcode

macosvoiceoverxcode

VoiceOver interprets a hyphen as a brief pause. That makes sense for hyphenated words, but it makes no sense for sums or for code. For example in Xcode this line

numberOfGuesses -= 1

is rendered as "number of guesses, equals one" by VoiceOver. That's terrible. How do I make VoiceOver behave sensibly for the minus sign in Xcode?

Best Answer

In VoiceOver Utility, you can go to the Pronunciation tab of the Speech section, and set up custom pronunciations. I've never used VoiceOver before, but I was able to get some custom pronunciations working. I set -= to be replaced by minus equals, and that seemed to work. Additionally, you can make these custom pronunciations app specific, or work in all apps, if you only want Xcode to read hyphens as minus signs. See here for more details.