How to make your IOS apps more accessible to people with disabilities.
Introduction
Today we will cover different ways of making our IOS app accessible using built in frameworks that are already part of UIKit, and other apple frameworks. This may be a shocker for you but I am visually impaired and use accessibility features such as VoiceOver, and Zoom on a daily basis. This is why I am making this tutorial so that you can understand how to make apps accessible from a new point of view. The sited make apps accessible a little bit different. The difference is that I know the ins and outs of accessibility in IOS as a user, not just as a developer. So lets get started with this journey.
Labeling UI elements
The code above shows how to create a simple label for accessibility features. For example using VoiceOver when you navigate on top of this image you will here the label we implemented. However this is only useful with static images, for example logo’s, and images as buttons. For dynamic images we need to use something with AI such as apple’s own vision API which will scan the image and describe it. You can pass in the Vision frameworks response as a accessibility label so that any image can be detected by accessibility features in IOS.
Perhaps our label contains too many Emoji’s, you can use a hint to bring more information to accessibility users. for example you use a Smile Emoji, but you don’t want to confuse the VoiceOver user, you can place a hint saying that the emoji represents laughter or something like this. Think of hints as notes for Accessibility users. Use hints to bring further understanding of something. Like usual don’t overuse them. They can get annoying if VoiceOver users keep getting them in the wrong places.
Localized Speech
VoiceOver and Text to Speech don't read other languages well. For example an English Voice will not sound good reading something in Spanish. Use AccessibilityLanguage to change to another Voice that belongs to the said language. Some apps such ad DuoLingo are dealing with many languages that localization dosn’t handle very well. This is when you want to put this to use. Reading a paragraph that switches to multiple languages can be made much more pleasant by implementing this. Their are ways of making a specific part of a string localized to a language for accessibility. Use this when dealing with scenarios like DuoLingo. Otherwise Localization will take care of VoiceOver, and Text to Speech.
This is a real world scenario of how to localize strings using accessibility frameworks. Note that the else statement contains a line of code that when that the label does not contain that sentence switch back to default language. Don’t assume that the default language is English because this is not good practice.
PS.
There are lots of customizations you can do for accessibility. However they require a full tutorial on its own. some of the best customization for accessible apps are done using custom functions that are inherited from Objective-C. Thanks for reading my tutorial. We hope to see you soon.