Accessibility up to 11! LogoAccessibility 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

You may also find interesting...

Day 202

With regular buttons from UIKit or SwiftUI, you are all set. With complex views, headings, or table/collection view cells that, when selected, bring the user somewhere else in the app or perform an action, you'll have to add the button trait.

SwiftUIUIKitisSelected

Day 110

As with UIKit, in SwiftUI you can also add/remove a11y traits. But because of its declarative nature, you'll have to approach it in a slightly different way. A little nuance, but something that made me scratch my UIKit head when learning SwitUI.

SwiftUIUIKit

Day 94

Creating UIAccessibilityElements, combined with a semanticGroup accessibilityContainerType, can also help you make components as complex as charts accessible. Example from "Bring Accessibility to Charts" WWDC21: https://developer.apple.com/videos/play/wwdc2021/10122/

UIAccessibilityWWDCaccessibilityContaineraccessibilityElementaccessibilityElementsiOS

Content © Daniel Devesa Derksen-Staats — Accessibility up to 11!


← Day 3
Day 1 →

Created in Swift with Ignite.

Supporting Swift for Swifts