The AXChart
used to describe your chart and its data.
accessibilityChartDescriptor(_:)
Availability 有効性
- iOS 15.0+
- iPadOS 15.0+
- macOS 12.0+
- Mac Catalyst 15.0+
- tvOS 15.0+
- watchOS 8.0+
Technology
- Swift
UI
Declaration 宣言
func accessibilityChartDescriptor<R>(_ representable: R) -> some View
where R : AXChartDescriptorRepresentable
Parameters パラメータ
chartDescriptor
Descriptor Representable
Discussion 議論
Use this method to provide information about your chart view to allow VoiceOver and other assistive technology users to perceive and interact with your chart and its data.
This may be applied to any View that represents a chart, including Image and custom-rendered chart views.
The accessibility
modifier can be applied to -any- view representing a chart, the simplest case being just an image of a chart. The implementation details of the view aren’t important, only the fact that it represents a chart, and that the provided chart descriptor accurately describes the content of the chart.
Example usage:
First define your AXChart
type.
struct MyChartDescriptorRepresentable: AXChartDescriptorRepresentable { func makeChartDescriptor() -> AXChartDescriptor { // build and return your AXChart
here }
func updateChartDescriptor(_ descriptor: AXChartDescriptor) {
// Update your chart descriptor with any new values, or
// don't override if your chart doesn't have changing values.
}
}
Then use the accessibility
modifier to provide an instance of your AXChart
type to the view representing your chart:
SomeChartView() .accessibilityChartDescriptor(MyChartDescriptorRepresentable())