I have a view hierarchy as follows:
UIView
\-- UIStackView
+-- UILabel
\-- UILabel
By default, VoiceOver skips over the UIView and stops on each of the UILabels separately.
I would like VoiceOver to stop on the UIView and combine its contents (i.e. read the accessibility label of each of its accessible children one by one). Does UIKit offer an API to achieve this similar to SwiftUI's accessibilityElement(children: .combine) API?
Notes
- I know I can set
isAccessibilityElementtotrueon theUIViewand then set itsaccessibilityLabelto"\(label1.text!) \(label2.text!)". I'm wondering whether there is an automatic means of achieving this which doesn't require me to define theUIView'saccessibilityLabel. - The problem with having to define the
UIView'saccessibilityLabelmanually based on its children is that I have to remember to change theUIView'saccessibilityLabelin every place where thetextoraccessibilityLabelof any of its children changes.