Accessibility up to 11! LogoAccessibility up to 11! Logo - Dark ModeAccessibility up to 11!
  • Blog
  • #365DaysIOSAccessibility
  • Apps
  • About
  • Resources
  • RSS
#365DaysIOSAccessibility

Day 2

20 May 2022

Accessibility ModifiersSwiftUIUIAccessibilityUIKit

By

Daniel Devesa Derksen-Staats

SwiftUI has equivalent accessibility modifiers for some of UIAccessibility's properties in UIKit. Same basic concepts apply.

Label: https://developer.apple.com/documentation/swiftui/view/accessibilitylabel(:)-9ek2h

Value: https://developer.apple.com/documentation/swiftui/view/accessibilityvalue(:)-8esl7

Traits: https://developer.apple.com/documentation/swiftui/view/accessibilityaddtraits(:)

Hint: https://developer.apple.com/documentation/swiftui/view/accessibilityhint(:)-3i2vu

Some of you have asked me how you can support what I do. This would really help, and would be hugely appreciated:

  • Find these posts useful? Share them at work, on social media, or with anyone that might find them interesting. Let's spread the word!

  • Check out any of my apps or games: Xarra!, RetroRapid!, or Mestre!.

    • A download and a review go a long way. They're free by default. On the App Store, ratings and reviews really help more people discover them.

    • Finding any of them useful? If so, and if you can afford it, purchasing lifetime access to all features or subscribing lets me buy the coffee that keeps me caffeinated. Caffeine keeps me going to maintain the apps, bring in new features that I hope you'll love, and keep writing.

You may also find interesting...

Day 135

If you use SwiftLint in your SwiftUI project, there is a rule, by @rerycole34, for making sure that your images have either an accessibility label or are hidden for assistive tech because they might be decorative. Rule: https://realm.github.io/SwiftLint/accessibility_label_for_image.html

SwiftUIaccessibilityLabel

Day 1

UIAccessibility is the cornerstone of any accessible UIKit app. Among others, understanding what an accessibility label, value, trait or hint are, is key. This is an example of how they could be configured for a custom rating component. #GAAD2022

GAADGAAD2022UIAccessibilityUIKitaccessibilityLabel

Day 109

The equivalent of using a .semanticGroup accessibilityContainerType in UIKit, would be to use the .accessibilityElement(children: ) modifier with the .contain option in SwiftUI. Here's a refresher with some use-cases: https://x.com/dadederk/status/1558790851496742914

SwiftUIUIKitaccessibilityContaineraccessibilityElement

Content © Daniel Devesa Derksen-Staats on Accessibility up to 11! is licensed under CC BY 4.0. License details


← Day 3
Day 1 →

Created in Swift with Ignite.

Supporting Swift for Swifts