Short & practical guides on accessibility in SwiftUI

Lisa Dziuba
Oct 23 · 3 min read

Making your app accessible is critical 💛

And SwiftUI gives us a lot of accessibility for free! Rob Whitaker from Capital One made a great series of 3–4 minutes guides on SwiftUI accessibility. There you can learn how to get the most from SwiftUI built-in features and make your app understandable for all users.

If you’re working with UI implementation, you’ll enjoy our new collection on 1500 plugins for popular design tools (Sketch, XD, Figma). And btw, we’re on Product Hunt today 😉

✍️ SwiftUI Accessibility: Traits
Accessibility traits are a group of attributes on a SwiftUI element. They inform assistive technologies on how to interact with element. Each element has a selection of default traits which you can change.

👀 SwiftUI Accessibility: Accessible User Interface
When customers enable an assistive technology to navigate your app, the interface isn’t exactly the same as the one visible on the screen. Users navigate a modified version that iOS creates especially for assistive technology. This is known as the accessibility tree or an accessible user interface. iOS does an incredible job at creating the AUI for you from your SwiftUI code.

💛 SwiftUI Accessibility: Attributes
We can help iOS in creating an Accessible User Interface by tweaking some element’s accessibility attributes. Setting some accessibility attributes through modifiers is a simple way to add more meaning and context for your assistive technology users.

🔚 SwiftUI Accessibility: Sort Priority
Assistive technology, such as VoiceOver, works in natural reading direction. In English, this means top left through to the bottom right. Mostly this is the right decision for assistive technology to make. This is the order anyone not using assistive technology would experience your app. Sometimes though, we make designs that don’t read in this way.

📣 SwiftUI Accessibility: Named Controls
One big accessibility improvement in SwiftUI comes in the form of named controls. Nearly all controls and some non-interactive views can take a Text view as part of their view builder. The purpose of this is to tie the meaning to the control.

🖼 SwiftUI Accessibility: Images
Images in SwiftUI are accessible by default. This is the opposite of what we’d experience in UIKit, where images are not accessible unless you set isAccessibilityElement to true. But there still some nuances you need to keep in mind!

📝 SwiftUI Accessibility: Dynamic Type
Like all accessibility features, Dynamic Type is about customization. Many of your customers, and maybe even you, are using Dynamic Type without even considering it an accessibility feature. Dynamic type allows iOS users to set the text to a size that they find comfortable to read. With SwiftUI it got superpowers.

Wow :) That was a lot! Huge thanks go to Rob Whitaker for sharing his knowledge!

If you wish to share your knowledge with the iOS community, just submit your guide here. See you soon!

Flawless iOS

🍏 Community around iOS development, mobile design, and marketing

Lisa Dziuba

Written by

Swift Learner. Growth Hacker. Co-founder of https://flawlessapp.io/

Flawless iOS

🍏 Community around iOS development, mobile design, and marketing

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade