This is an email from Flawless iOS.

Short & practical guides on accessibility in SwiftUI

Lisa Dziuba
Oct 23, 2019 · 3 min read
Image for post
Image for post

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.

Image for post
Image for post

🔚 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.

Image for post
Image for post

🖼 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.

Image for post

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…

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store