Making your app accessible to your tests

One of the lesser thoughts about features in iOS is accessibility. The design teams at Apple work hard to ensure that iOS is accessible for everybody. This includes blind people and people with other disabilities that could somehow affect the user's ability to operate their iOS device.

Just looking at the accessibility settings in the iOS settings app makes it evident that this is a subject that Apple invests a lot of time in. If you're working on an app, Apple expects you to put in the same kind of effort. Doing this will be rewarded by more app downloads and if you're lucky, even a couple of great reviews. In their talk on iOS Accessibility from WWDC 2015, Apple even mentioned that implementing accessibility features can be helpful if you ever want to be featured in the App Store. Only the best apps get featured by Apple, and if your app is accessible to all people, that significantly boosts your app's quality.

A common myth surrounding accessibility is that it's hard to implement or that it takes a lot of time. Some people even go so far as to say that it looks ugly or gets in the way of beautiful design. None of this is entirely correct. Sure, making your app accessible requires some effort, but the UIKit framework is very helpful when it comes to accessibility. Using standard components and keeping your user in mind while you design your app will make sure that your app is both accessible and looks good.

So, how does accessibility work on iOS? And how can we make sure our app is accessible? A fun way to experiment with this is to turn on VoiceOver on your device. To enable VoiceOver, go to the Accessibility menu. You'll find several vision-related accessibility settings. VoiceOver should be the topmost one. To quickly enable and disable VoiceOver, scroll all the way to the bottom of the settings page and select VoiceOver as your accessibility shortcut:

This will allow you to toggle VoiceOver off and on by triple-clicking the home button or side button, depending on your device.

After enabling this, run the MovieTrivia app on your device and triple-click your home button or side button to enable VoiceOver. Swipe around and try to use the app. This is how a person with a visual handicap uses your app. You won't get past the loading screen because the dummy questions aren't loaded, but you should find the splash screen to be pretty accessible, especially considering no special work had to be done to achieve this. UIKit uses great default settings to make sure your app will be accessible by default.

You can set your own accessibility information through the Identity Inspector in Interface Builder. You can add custom labels, hints, identifiers, and traits to your interface to aid accessibility and, coincidentally, your UI tests. The following screenshot shows the accessibility panel:

For most UIKit interface elements, you won't have to touch these settings yourself. UIKit will make sure that your objects have sensible defaults that automatically make your app accessible. Now that you have a little bit of background information about accessibility, let's have a look at testing the app's (accessible) UI.