When interacting with a button with VoiceOver, the accessibility label is repeated to the user. If you are playing some audio, it could be difficult to listen to it properly. To avoid that, you can add the .startsMediaSession accessibility trait.

An app for learning Dutch has an audio clip to play how you would say Hi. When the play button is focused with VoiceOver, it says: “Play, button”. If you double tap the play button, VoiceOver will say: “Play” at the same time that the audio clip plays, saying: “Hoi!”. If you add the starts media session accessibility trait, VoiceOver won’t say anything back when double tapping the button, and you’ll just hear the audio clip saying: “Hoi!”.

You may also find interesting...

When using Voice Control, say: "Show names". You'll see all the accessibility labels for interactive elements overlaid on the screen. It will help you identify labels that can be improved, or actually missing. Labels are not just for VoiceOver.

There is another accessibility trait: .playsSound, that does a similar thing than .startsMediaSession. This one seems more suitable for buttons that have their own sound effects when interacting with them, like it often happens in games.

accessibilitySpeechIPANotation is sometimes handy in English where a word is spelled the same but pronounced differently depending of the context. Some examples are: live, read... Or you may want to correct how VoiceOver pronounces your app's name! Example code in the image: ```swift let liveNewsChannelView = UIView() let attributedLabel = NSMutableAttributedString(string: "24 hour news channel. ") attributedLabel.append(NSAttributedString(string: "Live",attributes: [.accessibilitySpeechIPANotation: "laɪv"])) liveNewsChannelView.accessibilityAttributedLabel = attributedLabel ```

Created in Swift with Ignite.

Supporting Swift for Swifts