swiftui_native/view/
accessibility.rs1use super::{View};
8use crate::views;
9
10impl View {
11 pub fn a11y_hint(self, hint: &str) -> Self {
19 Self::new(views::accessibility_hint(&self.handle, hint))
20 }
21
22 pub fn a11y_value(self, value: &str) -> Self {
25 Self::new(views::accessibility_value(&self.handle, value, true))
26 }
27
28 pub fn a11y_identifier(self, id: &str) -> Self {
31 Self::new(views::accessibility_identifier(&self.handle, id))
32 }
33
34 pub fn a11y_add_traits(self, traits: &[views::AccessibilityTrait]) -> Self {
36 Self::new(views::accessibility_add_traits(&self.handle, traits))
37 }
38
39 pub fn a11y_remove_traits(self, traits: &[views::AccessibilityTrait]) -> Self {
41 Self::new(views::accessibility_remove_traits(&self.handle, traits))
42 }
43
44 pub fn a11y_heading(self, level: views::HeadingLevel) -> Self {
47 Self::new(views::accessibility_heading(&self.handle, level))
48 }
49
50 pub fn a11y_sort_priority(self, priority: f64) -> Self {
52 Self::new(views::accessibility_sort_priority(&self.handle, priority))
53 }
54
55 pub fn a11y_input_labels(self, labels: &[&str]) -> Self {
58 Self::new(views::accessibility_input_labels(&self.handle, labels, true))
59 }
60
61 pub fn a11y_responds_to_interaction(self, responds: bool) -> Self {
63 Self::new(views::accessibility_responds_to_user_interaction(&self.handle, responds))
64 }
65
66 pub fn a11y_text_content_type(self, kind: views::TextContentType) -> Self {
69 Self::new(views::accessibility_text_content_type(&self.handle, kind))
70 }
71
72 pub fn a11y_action(self, kind: views::ActionKind, action: impl Fn() + 'static) -> Self {
81 Self::new(views::accessibility_action(&self.handle, kind, action))
82 }
83
84 pub fn a11y_actions(self, category: views::ActionCategory, content: View) -> Self {
86 Self::new(views::accessibility_actions(&self.handle, category, content.handle()))
87 }
88
89 pub fn a11y_adjustable_action(self, action: impl Fn(i64) + 'static) -> Self {
92 Self::new(views::accessibility_adjustable_action(&self.handle, action))
93 }
94
95 pub fn a11y_scroll_action(self, action: impl Fn(i64) + 'static) -> Self {
97 Self::new(views::accessibility_scroll_action(&self.handle, action))
98 }
99
100 pub fn a11y_zoom_action(self, action: impl Fn() + 'static) -> Self {
102 Self::new(views::accessibility_zoom_action(&self.handle, action))
103 }
104
105 pub fn a11y_element(self, children: views::AccessibilityChildBehavior) -> Self {
108 Self::new(views::accessibility_element(&self.handle, children))
109 }
110
111 pub fn a11y_children(self, children: View) -> Self {
114 Self::new(views::accessibility_children(&self.handle, children.handle()))
115 }
116
117 pub fn a11y_representation(self, representation: View) -> Self {
120 Self::new(views::accessibility_representation(&self.handle, representation.handle()))
121 }
122
123 pub fn a11y_labeled_pair(
126 self,
127 role: views::LabeledPairRole,
128 id: views::HashableValue<'_>,
129 ) -> Self {
130 Self::new(views::accessibility_labeled_pair(&self.handle, role, id))
131 }
132
133 pub fn a11y_linked_group<'h>(self, id: impl views::IntoHashable<'h>) -> Self {
135 Self::new(views::accessibility_linked_group(&self.handle, id.into_hashable()))
136 }
137
138 pub fn a11y_custom_content(
141 self,
142 key_label: &str,
143 id: &str,
144 value: &str,
145 importance: views::CustomContentImportance,
146 ) -> Self {
147 Self::new(views::accessibility_custom_content(
148 &self.handle,
149 key_label,
150 id,
151 value,
152 importance,
153 ))
154 }
155
156 pub fn a11y_activation_point(self, x: f64, y: f64) -> Self {
159 Self::new(views::accessibility_activation_point(&self.handle, x, y))
160 }
161
162 pub fn a11y_drag_point(self, x: f64, y: f64, description: &str) -> Self {
164 Self::new(views::accessibility_drag_point(&self.handle, x, y, description, true))
165 }
166
167 pub fn a11y_drop_point(self, x: f64, y: f64, description: &str) -> Self {
169 Self::new(views::accessibility_drop_point(&self.handle, x, y, description, true))
170 }
171
172 pub fn a11y_direct_touch(
175 self,
176 enabled: bool,
177 options: &[views::DirectTouchOption],
178 ) -> Self {
179 Self::new(views::accessibility_direct_touch(&self.handle, enabled, options))
180 }
181
182 pub fn a11y_scroll_status(self, status: &str) -> Self {
184 Self::new(views::accessibility_scroll_status(&self.handle, status, true))
185 }
186
187 pub fn a11y_shows_large_content_viewer(self) -> Self {
189 Self::new(views::accessibility_shows_large_content_viewer(&self.handle))
190 }
191
192}