klemensstrasser,
@klemensstrasser@mastodon.social avatar

I’m adding better Voice Control support to @studysnacksapp to celebrate the Global Accessibility Awareness Day. It’s amazing with how little code you can make it so much better 😍

A thread on what Voice Control is, what the problems in my app are, and how I fix them🧵

klemensstrasser,
@klemensstrasser@mastodon.social avatar

Voice Control is an feature where you speak out an interaction and the system does it for you.

The easiest example is a tab. To post this thread on X, I could say „Tab Post All“ and the system does it for me.

There are other gestures, but we stick with the tab for this thread.

klemensstrasser,
@klemensstrasser@mastodon.social avatar

Now in the example I just gave, it’s clear what you have to say, as the button has a simple text label that just says „Post all“.

But if you work with icons like I do, it’s not always clear what you have to say to trigger the interaction. 😖

There is a solution though - You can say „Show Names“ and the system shows you the actual label of each interactive element

klemensstrasser,
@klemensstrasser@mastodon.social avatar

But if you have long labels on interactive elements, like I sometimes do, it can become quite tedious to speak it out in full 😰

So you can also ask „Show numbers“ to get a number for each element and then say „Tab 5“ to interact with the fifth element on screen.

klemensstrasser,
@klemensstrasser@mastodon.social avatar

But there is a better solution. You can also add custom activation commands for Voice Control by adding ‚accessibilityInputLabels()‘. 😍

As for almost everything, there is a great @twostraws tutorial on the matter:

https://www.hackingwithswift.com/quick-start/swiftui/how-to-add-custom-activation-commands-for-voice-control

klemensstrasser,
@klemensstrasser@mastodon.social avatar

Now after this long introduction, let’s come to how I used accessibilityInputLabels to enhance Voice Control support for @studysnacksapp 😋

I have a focus view with three items with long labels. Using VoiceControl I need to say: „Tab Starter. 5 known pairs, one after another“ to actually activate it.🫤

Adding „Starter“ to the accessibilityInputLabels, I can simply say „Tab Starter“ to active it.

Much better! 😍

klemensstrasser,
@klemensstrasser@mastodon.social avatar

To create a new list, I have a plus button on this screen. The command to active it is „Add List“.

But this might not be intuitive. A user might want to say „New List“, „Create List“ - or simply „New“ or „Add“

So I just added them all as accessibilityInputLabels.

Nice! 😁

klemensstrasser,
@klemensstrasser@mastodon.social avatar

One last example!

I learn Spanish and French, so the names of these lists include the language to distinguish between them. 🇫🇷 🇪🇸

But for Voice Control, it’s tedious to speak out „Fruits (Spanish)“.
So adding „Fruits“ as accessibilityInputLabel makes it easier to interact!

klemensstrasser,
@klemensstrasser@mastodon.social avatar

That’s it! Hope you learned something ☺️

The Study Snacks update will be released on May 16th in time for the Global Accessibility Awareness Day.

If you don’t have anything planned for yet, why not enhance your Voice Control support too? 😊

https://apps.apple.com/at/app/study-snacks-languages-more/id6444380323?l=en-GB

  • All
  • Subscribed
  • Moderated
  • Favorites
  • accessibility
  • InstantRegret
  • ngwrru68w68
  • everett
  • mdbf
  • modclub
  • rosin
  • khanakhh
  • DreamBathrooms
  • thenastyranch
  • magazineikmin
  • Youngstown
  • GTA5RPClips
  • slotface
  • kavyap
  • JUstTest
  • ethstaker
  • osvaldo12
  • normalnudes
  • tacticalgear
  • cisconetworking
  • cubers
  • Durango
  • Leos
  • anitta
  • tester
  • megavids
  • provamag3
  • lostlight
  • All magazines