iOS accessibility header image

iOS’s accessibility testing in Xcode

Xcode and iOS have a plethora of easy to use accessibility tools and features built in.

Xcode’s SwiftUI Previews shows live, interactive previews of your app’s views allowing for accessibility testing to be undertaken without needing to build and run the app on a physical device. This helps to form quick feedback loops during development allowing for faster iteration when working with accessibility.

The previews can be configured to display the screen in varying accessibility modes. This quickly showed us what happens when a user increases the text size with Dynamic Type, for example. We were able to see how changes in text sizing could affect the screen’s layout, and affect the usability of the app. Larger text caused issues with wrapping points and in some cases caused other elements like buttons to be pushed off screen to make room for the larger text. It’s important to consider these issues, as they may make using the accessibility features counterproductive to users if they cause the app to be unusable.

With these issues highlighted, we could take steps to mitigate them, for example, by setting upper limits on the maximum text size, or ensuring that any changes in layout caused by text sizing doesn’t negatively affect the app’s usability. For example, if a text size change causes a button to be repositioned off screen, we can include a scroll view to ensure that the user can still scroll the button into view when they need to access it.

The accessibility inspector allows the developer to highlight a particular view and see accessibility information about that view. This allows us to ensure that the features we expect to be enabled are enabled, for example, being able to see what a screen reader (such as Voice Over) will read to users that are blind or partially-sighted when highlighting that view. We can use this information to decide whether that accessibility label is appropriate or if we need to override it with something more contextual and useful.

iOS’s user-friendly VoiceOver testing

Voice Over is a powerful, fully-integrated screen reader for iOS that allows users that are blind or partially-sighted to utilise the full potential of their iOS devices.

Enabling Voice Over allows a user to know what’s being shown on a screen by having a description read aloud to them. They navigate through the app with a combination of swipes and taps. When swiping, Voice Over reads out the highlighted elements and informs the user what actions can be taken.

The most effective way to test Voice Over was to run the app on a device, enable Voice Over and then close your eyes and attempt to use the app. This soon highlighted regions of the app that were being missed out by Voice Over or elements that were unselectable due to how they were nested within views etc.

In order to address these issues, it is important to consider how a screen is constructed and how views are related. Unnecessary nesting of views may cause them to be skipped or become inaccessible via the swipe navigation.

We also noticed that some views that are present purely for layout reasons were being read out by Voice Over when they should not be. A view such as an EmptyView should be hidden to the accessibility system to prevent it from being considered when navigating or describing a screen. We were able to ensure that all such views were marked hidden thanks to this testing.

Switch Control is an accessibility feature for users with mobility impairments that allow them to interact with their device with limited movements. A specialised UI control is displayed by the system that provides the user with shortcuts for things that may require them to reach to the top of the screen, or perform a gesture that they may not be capable of. Switch control also enables users to navigate an app in a similar way to users that are blind or partially-sighted, with combinations of swipes and taps, but without the need for having the screen and elements be described aloud.

When using Switch Control it is important to consider that your UI is fully accessible by the system so that the gesture shortcuts and highlights work as should be expected. The same considerations for screen layout and construction apply as when using Voice Over.

Key takeaways

  • Apple truly cares about accessibility, and so should all App Developers. The tools are extensive and built right into Xcode making this easy.
  • Applying accessibility to app design can make you rethink an entire layout.
  • Accessibility testing is important – without it you may not know which areas are not being covered.