Discussion 議論
Use this behavior when you want a view represented by a single accessibility element. The new accessibility element merges properties from all non-hidden children. Some properties may be transformed or ignored to achieve the ideal combined result. For example, not all of Accessibility
are merged and a default
action may become a named action (init(named:)
).
struct UserCell: View {
var user: User
var body: some View {
VStack {
Image(user.image)
Text(user.name)
Button("Options", action: showOptions)
}
.accessibilityElement(children: .combine)
}
}
A new accessibility element is created when:
The view contains multiple or zero accessibility elements
The view wraps a
UIView
/Representable NSView
.Representable
Note 注意
If an accessibility element is not created, the Accessibility
of the existing accessibility element is modified.