Type Property 型プロパティ

combine

Any child accessibility element’s properties are merged into the new accessibility element.

Declaration 宣言

static let combine: AccessibilityChildBehavior

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 AccessibilityTraits 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: