How to Build Inclusive iOS Mobile Experiences? Prioritize Accessibility.

Dheeru
Intuit Engineering
Published in
5 min readJul 9, 2024

This blog is co-authored by Dheeru Neelam, Senior Software Engineer, and Manish Verma, Senior Staff Software Engineer, at Intuit

Delivering on Intuit’s mission to power prosperity for 100 million consumer and small business customers requires us to make our products and services accessible for everyone, regardless of their abilities. But getting accessibility right involves a lot more than checking the right boxes. It means making inclusive design a standard practice and giving developers a natural path for creating clear, intuitive, easy-to-use interfaces.

As a developer working on Intuit’s flagship iOS applications, such as Intuit TurboTax and QuickBooks, I’ve had the opportunity to prioritize accessibility support in our design and development processes. Our efforts have enhanced user experiences, extended the benefits of our products to a broader customer base, and positively contributed to our company’s brand reputation, all in compliance with legal and regulatory standards.

Leverage Apple’s iOS dev tools for accessibility
A key contributor to our success are built-in iOS developer tools, which make it possible to identify and address areas where accessibility may fall short. Apple’s development environment, Xcode, and its programming language, Swift, provide a wide range of accessibility features. Following are examples of support for visually impaired, deaf or hard-of-hearing, motion sensitivity, and cognitive, learning or physical disabilities: voiceover, closed captions and subtitles: dynamic type, assistive touch, switch control, bold text, guided access and reduced motion,

Supplement iOS tools with helpful guidance to simplify and streamline accessibility design for developers
While certain guidelines are available for accessibility within iOS tools, we have developed an additional set of tips and tricks to help Intuit developers identify potential issues during the development process and support implementation of more inclusive designs.

1. Automate code quality with SwiftLint rules

SwiftLint is an open source code quality tool, which provides a set of customizable rules for enforcing coding standards and best practices in Swift code. It checks the code against a set of rules designed to enforce common standards and conventions in code. The tool generates warnings or errors if it detects violations of these rules.

Rules that help enforce accessibility include:

Accessibility_label_for_image — images that provide context should have an accessibility label or should be explicitly hidden from accessibility. Imagine an image of a “photo” button in an app. This image clearly conveys functionality and should have a descriptive label like “Mountain Landscape.”

Image(systemName: "Photo")
.accessibilityLabel(Text("Mountain Landscape")) // This is correct

In contrast, imagine an image of a house icon representing the “home” section in an app. A wrong label like “image” wouldn’t be helpful.

Image(systemName: "house")
.accessibilityLabel("image") // Incorrect (unclear purpose)

Accessibility_trait_for_button — all views that use tap gestures should include the .isButton or .isLink accessibility traits so that assistive technologies recognize them properly. Text like “click here” with a tap gesture that lacks the .isButton trait might confuse assistive technologies.

Text("Click here")
.onTapGesture { /* some action */ } // Incorrect (missing trait)

2. Incorporate accessibility audits into user interface testing

Xcode 15+ provides a new method called performAccessibilityAudit.

This method provides an easy way to test an app’s accessibility across a set of predefined audit types, including contrast, dynamicType, elementDetection, hitRegion, parentChild, sufficientElementDescription, textClipped, and trait. It also provides an issue handler to help filter out false positives.

class AccessibilityAuditTests: XCTestCase {
func testOnboardingViewAccessibility() throws {
let app = XCUIApplication()
app.launch()
try app.performAccessibilityAudit()
}
}

The audit reports whether testing succeeded or failed. It also provides an explanation for any failures, so developers can mitigate issues efficiently.

The Apple Worldwide Developer Conference 2023 workshop, Perform accessibility audits for your app, offers additional information about how to incorporate accessibility audits into your development pipeline.

3. Improve user experiences with Swift native accessibility functions

Swift provides a set of native accessibility functions developers can use to improve user experiences — our team has found the following examples especially useful:

voiceOverStatusDidChangeNotification — this built-in iOS screen reader helps users with visual impairments by reading aloud content and user interface elements. Notification is sent to the developer when:

  • VoiceOver is turned on or off in the Settings app
  • The user triple-taps the Home button to toggle VoiceOver on or off

Developers can take advantage of this notification to adjust app behavior and improve accessibility for visually impaired users by:

  1. Adjusting audio descriptions: when VoiceOver is enabled, your app can provide more detailed audio descriptions of images or other visual elements to help visually impaired users understand the content of the screen. For example, you may need to describe the color, shape, or position of on-screen elements to ensure that all users receive the full experience.
  2. Enhancing visual elements: when VoiceOver is disabled, your app can provide visuals that enhance the user experience. For example, animations or videos may be more effective when the user is visually engaged, leading to a more meaningful and enjoyable experience.
  3. Modifying interaction gestures: when VoiceOver is enabled, users interact with the app in a different way than when it’s disabled. Your app can respond by modifying the gesture recognizers and interaction methods to better cater to users with impaired vision.
  4. Maintaining compatibility: responding to the voiceOverStatusDidChangeNotification ensures your accessibility features continue to work with iOS updates and new versions of VoiceOver.

ScaledMetric — this allows developers to adjust the size of non-text elements in a user interface, such as icons or images, based on the size of the main text. This capability helps ensure all elements of an app’s layout remain properly proportioned for users who need a more readable font size. For example, a ScaledMetric could be defined to adjust the font size of a label’s contents in proportion to the user’s preferred text size, ensuring that the label remains readable regardless of user preferences.

With the @ScaledMetric Property Wrapper, it’s possible to proportionally scale numerical values alongside the Dynamic Type setting. This feature can prove useful when it comes to adapting values such as padding or image size according to ‌text size.

struct ContentView: View {
@ScaledMetric var imageSize = 100.0
var body: some View {
Image(systemName: "play.circle")
.resizable()
.frame(width: imageSize, height: imageSize)
}
}

If you require your scaling to align with a specific text segment, you can use the relativeTo parameter for your property wrapper. This parameter enables you to mention the font size you intend to match, keeping page elements proportional.

@ScaledMetric(relativeTo: .largeTitle) var imageSize = 100.0

DynamicTypeSize:

This feature allows users to adjust the font size of text displayed on their device in the accessibility settings.

SwiftUI supports Dynamic Type automatically, enabling views to expand and reduce size based on user preferences.

Text("This is always small")
.dynamicTypeSize(.xxLarge)

Developers can use the dynamicTypeSize() modifier to establish a fixed size, when needed.

VStack {
Text("Restricting the view to be in a certain range")
.dynamicTypeSize(DynamicTypeSize.large…DynamicTypeSize.xxxLarge)
Text("Will scale to any size")
Text("Restricting to large")
.dynamicTypeSize(…DynamicTypeSize.large)
}

While many customers rely on larger Dynamic Type sizes for iOS apps, others use it to display more information on their screens, so it’s best not to restrict the sizes supported in most cases.

Advocating for iOS accessibility today and in the future
By sharing our firsthand experiences, we hope you’ll be inspired to share yours!

By taking advantage of readymade iOS dev tools, developers can simplify and streamline app development, and preserve resources to tackle more complicated accessibility challenges. We’re proud of our accomplishments to date, and excited to contribute to a more accessible future for everyone, collectively as a dev community.

--

--

Dheeru
Intuit Engineering

Working on different apps. Interested in learning new technologies and help the app tear its functionality. Running around leaving scars