.accessibilityRepresentation(content: Component)
A component that replaces this component’s accessibility tree. Assistive technologies interact with this representation instead of the original component.
Support
Usage
Provide a simpler accessibility view for a complex visual
ZStack([
Circle().foregroundStyle(Color("blue")),
Text("75%").font("caption")
])
.accessibilityRepresentation(
Text("Progress: 75 percent")
)
Replace a custom layout with a descriptive label
HStack([
Image({ systemName: "star.fill" }),
Image({ systemName: "star.fill" }),
Image({ systemName: "star.fill" }),
Image({ systemName: "star" }),
Image({ systemName: "star" })
])
.accessibilityRepresentation(
Text("Rating: 3 out of 5 stars")
)
See Also