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

An Apple Newton device, representing an iPhone, shows a custom  component for rating conferences. It consists of 5 thumbs up. The 5 of them are selected for the NSSpain conference. Suggested configuration for the component:

You may also find interesting...

In UIKit, to create an adjustable component we need to add the adjustable trait and override both accessibilityIncrement() and accessibilityDecrement(). In SwiftUI, everything you need is bundled in the accessibilityAdjustableAction(_:) modifier.

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

Tomorrow is @gbla11yday! And I'm going to start a challenge, tweeting everyday, for a whole year, about tips, resources, and other useful info on how to develop accessible iOS apps. Are you up for the challenge? #GAAD

Created in Swift with Ignite.

Supporting Swift for Swifts