100 Days of SwiftUI Day 74

100 Days of SwiftUI – Day 74

We’ve arrived at day 74 of the 100 Days of SwiftUI! We wrapped up yet another project yesterday, making it a total of 14 now. We can’t be sitting still though, as we’re moving on the project 15 right away. The focus will be on adding accessibility features to our apps to ensure everyone is able to use and enjoy our creations. Let’s dive in!

Identifying views with useful labels in SwiftUI

By providing labels to our views, VoiceOver is able to identify and read these labels out loud for users, allowing them to understand what’s on display.

VoiceOver is an industry‑leading screen reader that tells you exactly what’s happening on your device. VoiceOver can now describe people, objects, text, and graphs in greater detail than ever. Auditory descriptions of elements help you easily navigate your screen through a Bluetooth keyboard or simple gestures on a touchscreen or trackpad. And with unique rotor gestures that function like a dial on touchscreens and trackpads, you can make content such as websites a breeze to browse.

Apple.com

Hiding and grouping accessibility data

If you spend even a few minutes with an active VoiceOver user, you’ll learn two things very quickly: they are remarkably adept at navigating around user interfaces, and they also often set reading speed extremely fast – way faster than you or I would use.

It’s important to take both of those things into account when we’re designing our UI: these users aren’t just trying VoiceOver out of curiosity, but are instead VoiceOver power users who rely on it to access your app. As a result, it’s important we ensure our UI removes as much clutter as possible so that users can navigate through it quickly and not have to listen to VoiceOver reading unhelpful descriptions.

Hacking with Swift, Paul Hudson (@twostraws)

Besides using labels in views, there are multiple other ways we can improve the way VoiceOver goes over our app in SwiftUI.

Paul focuses on these three:

  • Marking images as being unimportant for VoiceOver.
  • Hiding views from the accessibility system.
  • Grouping several views as one.

Reading the value of controls

By default SwiftUI provides VoiceOver readouts for its user interface controls, and although these are often good sometimes they just don’t fit with what you need. In these situations we can use the accessibilityValue() modifier to separate a control’s value from its label, but we can also specify custom swipe actions using accessibilityAdjustableAction().

Hacking with Swift, Paul Hudson (@twostraws)

Check out how to implement this here.

Wrap up

That’s it for day 74! We’re going back to earlier SwiftUI apps tomorrow and work on those to add accessibility features to make them more widely usable. Stay tuned for that!

Darryl

Hi! My name is Darryl and this is my personal blog where I write about my journey as I learn programming! You'll also find articles about other things that interest me including games, tech and anime.

Post navigation

Leave a Comment

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

100 Days of SwiftUI – Day 1 – Variables & Constants

100 Days of SwiftUI – Day 92

100 Days of SwiftUI – Day 21 – Design

100 Days of SwiftUI – Day 61