Skip to main content

swiftui_native/view/
generated.rs

1//! Chainable `View` methods, generated from the `views` free functions.
2//!
3//! `swiftui!` lowers to this layer, so a modifier that exists only as a
4//! `views::` free function cannot be written in the macro. These are the
5//! wrappers that were missing, generated by `tools/gen_chainable.py` because
6//! they are mechanical; `tests/dx_tests.rs` re-runs it and fails on drift.
7
8use super::View;
9use crate::views;
10
11impl View {
12    /// Apply `.accessibilityAction(_:_:)`.
13    pub fn accessibility_action(self, kind: crate::views::ActionKind, action: impl Fn() + 'static) -> Self {
14        Self::new(views::accessibility_action(&self.handle, kind, action))
15    }
16
17    /// Apply `.accessibilityActions(category:_:)`.
18    pub fn accessibility_actions(self, category: crate::views::ActionCategory, content: View) -> Self {
19        Self::new(views::accessibility_actions(&self.handle, category, content.handle()))
20    }
21
22    /// Apply `.accessibilityActivationPoint(_:)`.
23    ///
24    /// A `UnitPoint` is two `CGFloat`s and frozen, so it arrives in d0 and d1
25    /// rather than by address.
26    pub fn accessibility_activation_point(self, x: f64, y: f64) -> Self {
27        Self::new(views::accessibility_activation_point(&self.handle, x, y))
28    }
29
30    /// Apply `.accessibilityAddTraits(_:)`.
31    pub fn accessibility_add_traits(self, traits: &[crate::views::AccessibilityTrait]) -> Self {
32        Self::new(views::accessibility_add_traits(&self.handle, traits))
33    }
34
35    /// Apply `.accessibilityAdjustableAction(_:)`.
36    ///
37    /// The direction reaches the callback as a case number: 0 is `.increment`,
38    /// 1 is `.decrement`.
39    pub fn accessibility_adjustable_action(self, action: impl Fn(i64) + 'static) -> Self {
40        Self::new(views::accessibility_adjustable_action(&self.handle, action))
41    }
42
43    /// Apply `.accessibilityChartDescriptor(_:)` with a synthesized representable.
44    ///
45    /// No public SwiftUI type conforms to `AXChartDescriptorRepresentable` — the
46    /// protocol exists for applications to adopt — so the conformance is built at
47    /// run time and hung on `EdgeInsets`, which the reference can name too.
48    pub fn accessibility_chart_descriptor(self) -> Self {
49        Self::new(views::accessibility_chart_descriptor(&self.handle))
50    }
51
52    /// Apply `.accessibilityChildren(children:)`.
53    pub fn accessibility_children(self, children: View) -> Self {
54        Self::new(views::accessibility_children(&self.handle, children.handle()))
55    }
56
57    /// Apply `.accessibilityCustomContent(_:_:importance:)`.
58    ///
59    /// The key is built first, through `AccessibilityCustomContentKey.init(_:id:)`
60    /// — four words of `LocalizedStringKey` and two of `String`, returning the key
61    /// through x8 because it is resilient. The modifier then takes that key by
62    /// address, its own label as another `LocalizedStringKey`, and the importance
63    /// in a register.
64    pub fn accessibility_custom_content(self, key_label: &str, id: &str, value: &str, importance: crate::views::CustomContentImportance) -> Self {
65        Self::new(views::accessibility_custom_content(&self.handle, key_label, id, value, importance))
66    }
67
68    /// Apply `.accessibilityDefaultFocus(_:_:)`.
69    ///
70    /// The binding's `Value` is generic here, which makes `FocusState<A>.Binding`
71    /// address-only — unlike the concrete `focused(_:)`, where it travels in three
72    /// registers.
73    pub fn accessibility_default_focus(self, value: bool) -> Self {
74        Self::new(views::accessibility_default_focus(&self.handle, value))
75    }
76
77    /// Apply `.accessibility(identifier:)`, the pre-`accessibilityIdentifier` name.
78    pub fn accessibility_deprecated_identifier(self, id: &str) -> Self {
79        Self::new(views::accessibility_deprecated_identifier(&self.handle, id))
80    }
81
82    /// Apply `.accessibilityDirectTouch(_:options:)`.
83    pub fn accessibility_direct_touch(self, enabled: bool, options: &[crate::views::DirectTouchOption]) -> Self {
84        Self::new(views::accessibility_direct_touch(&self.handle, enabled, options))
85    }
86
87    /// Apply `.accessibilityDragPoint(_:description:isEnabled:)`.
88    pub fn accessibility_drag_point(self, x: f64, y: f64, description: &str, enabled: bool) -> Self {
89        Self::new(views::accessibility_drag_point(&self.handle, x, y, description, enabled))
90    }
91
92    /// Apply `.accessibilityDropPoint(_:description:isEnabled:)`.
93    pub fn accessibility_drop_point(self, x: f64, y: f64, description: &str, enabled: bool) -> Self {
94        Self::new(views::accessibility_drop_point(&self.handle, x, y, description, enabled))
95    }
96
97    /// Apply `.accessibilityElement(_:)`.
98    pub fn accessibility_element(self, v0: crate::views::AccessibilityChildBehavior) -> Self {
99        Self::new(views::accessibility_element(&self.handle, v0))
100    }
101
102    /// Apply `.accessibilityFocused(_:)`.
103    pub fn accessibility_focused(self) -> Self {
104        Self::new(views::accessibility_focused(&self.handle))
105    }
106
107    /// Apply `.accessibilityHeading(_:)`.
108    pub fn accessibility_heading(self, level: crate::views::HeadingLevel) -> Self {
109        Self::new(views::accessibility_heading(&self.handle, level))
110    }
111
112    /// Apply `.accessibilityHidden(_:)`.
113    pub fn accessibility_hidden(self, hidden: bool) -> Self {
114        Self::new(views::accessibility_hidden(&self.handle, hidden))
115    }
116
117    /// Apply `.accessibilityHint(_:)`.
118    pub fn accessibility_hint(self, hint: &str) -> Self {
119        Self::new(views::accessibility_hint(&self.handle, hint))
120    }
121
122    /// Apply `.accessibilityIdentifier(_:)`.
123    pub fn accessibility_identifier(self, id: &str) -> Self {
124        Self::new(views::accessibility_identifier(&self.handle, id))
125    }
126
127    /// Apply `.accessibilityIgnoresInvertColors(_:)`.
128    pub fn accessibility_ignores_invert_colors(self, value: bool) -> Self {
129        Self::new(views::accessibility_ignores_invert_colors(&self.handle, value))
130    }
131
132    pub fn accessibility_input_labels(self, labels: &[&str], enabled: bool) -> Self {
133        Self::new(views::accessibility_input_labels(&self.handle, labels, enabled))
134    }
135
136    /// Apply `.accessibilityLabel(_:)`.
137    pub fn accessibility_label(self, label: &str) -> Self {
138        Self::new(views::accessibility_label(&self.handle, label))
139    }
140
141    /// Apply `.accessibilityLabeledPair(role:id:in:)`.
142    pub fn accessibility_labeled_pair<'h>(self, role: crate::views::LabeledPairRole, id: impl crate::views::IntoHashable<'h>) -> Self {
143        Self::new(views::accessibility_labeled_pair(&self.handle, role, id.into_hashable()))
144    }
145
146    /// Apply `.accessibilityLinkedGroup(id:in:)`.
147    pub fn accessibility_linked_group<'h>(self, id: impl crate::views::IntoHashable<'h>) -> Self {
148        Self::new(views::accessibility_linked_group(&self.handle, id.into_hashable()))
149    }
150
151    /// Apply `.accessibilityRemoveTraits(_:)`.
152    pub fn accessibility_remove_traits(self, traits: &[crate::views::AccessibilityTrait]) -> Self {
153        Self::new(views::accessibility_remove_traits(&self.handle, traits))
154    }
155
156    /// Apply `.accessibilityRepresentation(representation:)`.
157    pub fn accessibility_representation(self, representation: View) -> Self {
158        Self::new(views::accessibility_representation(&self.handle, representation.handle()))
159    }
160
161    /// Apply `.accessibilityRespondsToUserInteraction(_:)`.
162    pub fn accessibility_responds_to_user_interaction(self, responds: bool) -> Self {
163        Self::new(views::accessibility_responds_to_user_interaction(&self.handle, responds))
164    }
165
166    /// Apply `.accessibilityRotor(_:textRanges:)`.
167    ///
168    /// The ranges are real `Range<String.Index>` values taken from `text` — one
169    /// spanning the whole string. `Range` is frozen and its two bounds are stored
170    /// back to back, so the array elements are built directly rather than through an
171    /// initialiser.
172    pub fn accessibility_rotor(self, label: &str, text: &str) -> Self {
173        Self::new(views::accessibility_rotor(&self.handle, label, text))
174    }
175
176    /// Apply `.accessibilityRotorEntry(id:in:)`.
177    pub fn accessibility_rotor_entry<'h>(self, id: impl crate::views::IntoHashable<'h>) -> Self {
178        Self::new(views::accessibility_rotor_entry(&self.handle, id.into_hashable()))
179    }
180
181    /// Apply `.accessibilityScrollAction(_:)`.
182    ///
183    /// The edge reaches the callback as a case number, in `Edge`'s declared order:
184    /// top, leading, bottom, trailing.
185    pub fn accessibility_scroll_action(self, action: impl Fn(i64) + 'static) -> Self {
186        Self::new(views::accessibility_scroll_action(&self.handle, action))
187    }
188
189    /// Apply `.accessibilityScrollStatus(_:isEnabled:)`.
190    pub fn accessibility_scroll_status(self, status: &str, enabled: bool) -> Self {
191        Self::new(views::accessibility_scroll_status(&self.handle, status, enabled))
192    }
193
194    /// `.accessibility(selectionIdentifier:)` — which item of a selectable group
195    /// this is, for assistive technologies.
196    ///
197    /// Deprecated in Swift, with no modern replacement — `accessibilityIdentifier`
198    /// is a different thing (a test hook). Bound because it is the one member of
199    /// that family the crate could not otherwise reach.
200    ///
201    /// The argument is `AnyHashable`, which is three words: the boxed value, its
202    /// metadata and its `Hashable` witness.
203    pub fn accessibility_selection_identifier<'h>(self, id: impl crate::views::IntoHashable<'h>) -> Self {
204        Self::new(views::accessibility_selection_identifier(&self.handle, id.into_hashable()))
205    }
206
207    /// Apply `.accessibilityShowsLargeContentViewer(_:)`.
208    pub fn accessibility_shows_large_content_viewer(self) -> Self {
209        Self::new(views::accessibility_shows_large_content_viewer(&self.handle))
210    }
211
212    /// Apply `.accessibilitySortPriority(_:)`.
213    pub fn accessibility_sort_priority(self, priority: f64) -> Self {
214        Self::new(views::accessibility_sort_priority(&self.handle, priority))
215    }
216
217    /// Apply `.accessibilityTextContentType(_:)`.
218    pub fn accessibility_text_content_type(self, kind: crate::views::TextContentType) -> Self {
219        Self::new(views::accessibility_text_content_type(&self.handle, kind))
220    }
221
222    /// Apply `.accessibilityValue(_:isEnabled:)`.
223    pub fn accessibility_value(self, value: &str, enabled: bool) -> Self {
224        Self::new(views::accessibility_value(&self.handle, value, enabled))
225    }
226
227    /// Apply `.accessibilityZoomAction(_:)`.
228    pub fn accessibility_zoom_action(self, action: impl Fn() + 'static) -> Self {
229        Self::new(views::accessibility_zoom_action(&self.handle, action))
230    }
231
232    /// `.actionSheet(isPresented:content:)` — the iOS sheet of choices.
233    ///
234    /// Deprecated by Apple in favour of `confirmationDialog`, and bound because the
235    /// catalogue still lists it and an app targeting an older iOS has nothing else.
236    ///
237    /// `presented` is a constant, so the sheet cannot dismiss itself; use
238    /// `action_sheet_bound` for one the user can close.
239    #[cfg(not(target_os = "macos"))]
240    pub fn action_sheet(self, title: &str, message: Option<&str>, buttons: Vec<crate::views::AlertButton<'_>>) -> Self {
241        Self::new(views::action_sheet(&self.handle, title, message, buttons))
242    }
243
244    /// `.actionSheet` bound to Rust state, so dismissing it writes `false` back.
245    #[cfg(not(target_os = "macos"))]
246    pub fn action_sheet_bound(self, title: &str, message: Option<&str>, buttons: Vec<crate::views::AlertButton<'_>>, state: &crate::views::BoundState<bool>) -> Self {
247        Self::new(views::action_sheet_bound(&self.handle, title, message, buttons, state))
248    }
249
250    /// Apply `.allowedDynamicRange(_:)`.
251    pub fn allowed_dynamic_range(self, range: crate::views::DynamicRange) -> Self {
252        Self::new(views::allowed_dynamic_range(&self.handle, range))
253    }
254
255    /// Apply `.allowsHitTesting(_:)`.
256    pub fn allows_hit_testing(self, value: bool) -> Self {
257        Self::new(views::allows_hit_testing(&self.handle, value))
258    }
259
260    /// Apply `.allowsTightening(_:)`.
261    pub fn allows_tightening(self, value: bool) -> Self {
262        Self::new(views::allows_tightening(&self.handle, value))
263    }
264
265    /// Apply `.allowsWindowActivationEvents(_:)`.
266    pub fn allows_window_activation_events(self, allows: Option<bool>) -> Self {
267        Self::new(views::allows_window_activation_events(&self.handle, allows))
268    }
269
270    /// `.animation(_:value:)` with the curve named.
271    pub fn animation_kind(self, kind: crate::views::AnimationKind, value: i64) -> Self {
272        Self::new(views::animation_kind(&self.handle, kind, value))
273    }
274
275    /// `.aspectRatio(_:contentMode:)` with the mode named rather than spelled as a
276    /// `bool`.
277    ///
278    /// `None` for the ratio means "keep whatever the content already has", which is
279    /// not the same as `Some(1.0)`.
280    pub fn aspect_ratio_content_mode(self, ratio: Option<f64>, mode: crate::views::ContentMode) -> Self {
281        Self::new(views::aspect_ratio_content_mode(&self.handle, ratio, mode))
282    }
283
284    /// `.autocapitalization(_:)`.
285    ///
286    /// Deprecated in SwiftUI in favour of
287    /// `text_input_autocapitalization`, and bound because Apple's catalogue still
288    /// lists it and a caller targeting an older iOS has nothing else.
289    #[cfg(not(target_os = "macos"))]
290    pub fn autocapitalization(self, style: crate::views::Autocapitalization) -> Self {
291        Self::new(views::autocapitalization(&self.handle, style))
292    }
293
294    /// Apply `.background(_:)` with a Color.
295    pub fn background(self, r: f64, g: f64, b: f64, a: f64) -> Self {
296        Self::new(views::background(&self.handle, r, g, b, a))
297    }
298
299    /// Apply `.background(_:)` with an `AnyGradient` — what `.indigo.gradient` is.
300    pub fn background_any_gradient(self, color: u64) -> Self {
301        Self::new(views::background_any_gradient(&self.handle, color))
302    }
303
304    /// Apply `.background(alignment:content:)`.
305    ///
306    /// The same call as `.overlay(alignment:content:)` with a different symbol:
307    /// an `Alignment` in x0/x1, the content closure and its context in x2/x3, four
308    /// generic words after that. The colour-taking `background` next door is a
309    /// different overload entirely — that one is generic over `ShapeStyle`, this
310    /// one over `View`.
311    pub fn background_content(self, content: View, alignment: crate::views::Alignment) -> Self {
312        Self::new(views::background_content(&self.handle, content.handle(), alignment))
313    }
314
315    /// Apply `.backgroundExtensionEffect(_:)`.
316    pub fn background_extension_effect(self) -> Self {
317        Self::new(views::background_extension_effect(&self.handle))
318    }
319
320    /// Apply `.background(in:fillStyle:)` — the background style, clipped to a shape.
321    ///
322    /// The shape must be `InsettableShape`, not merely `Shape`, so its witness is a
323    /// different table from the one `super::Shape` carries.
324    pub fn background_in_circle(self) -> Self {
325        Self::new(views::background_in_circle(&self.handle))
326    }
327
328    /// Apply `.background(LinearGradient(colors:startPoint:endPoint:))`.
329    pub fn background_linear_gradient(self, colors: &[crate::Color], start: (f64, f64), end: (f64, f64)) -> Self {
330        Self::new(views::background_linear_gradient(&self.handle, colors, start, end))
331    }
332
333    /// Apply `.background(_: Material)` — the blur materials.
334    pub fn background_material(self, kind: crate::views::MaterialKind) -> Self {
335        Self::new(views::background_material(&self.handle, kind))
336    }
337
338    /// Apply `.background(RadialGradient(colors:center:startRadius:endRadius:))`.
339    pub fn background_radial_gradient(self, colors: &[crate::Color], center: (f64, f64), start_radius: f64, end_radius: f64) -> Self {
340        Self::new(views::background_radial_gradient(&self.handle, colors, center, start_radius, end_radius))
341    }
342
343    /// `.backgroundStyle(_:)` with a `Color`.
344    ///
345    /// `background_style_of` takes the style as raw bytes and a witness, which
346    /// is what an arbitrary `ShapeStyle` needs and what nothing can call without
347    /// building one first. These three name the styles that have a Rust spelling,
348    /// so the modifier is reachable the way the documentation writes it.
349    ///
350    /// Not `.background(_:)`: that draws behind *this* view, while this says what
351    /// style the views *inside* should use for their own backgrounds.
352    pub fn background_style_color(self, r: f64, g: f64, b: f64, a: f64) -> Self {
353        Self::new(views::background_style_color(&self.handle, r, g, b, a))
354    }
355
356    /// `.backgroundStyle(_:)` with one of the hierarchical levels.
357    pub fn background_style_hierarchical(self, level: crate::views::Hierarchical) -> Self {
358        Self::new(views::background_style_hierarchical(&self.handle, level))
359    }
360
361    /// `.backgroundStyle(_:)` with an already-resolved `Color` word.
362    pub fn background_style_value(self, color: u64) -> Self {
363        Self::new(views::background_style_value(&self.handle, color))
364    }
365
366    /// Apply `.badge(_:)`.
367    pub fn badge(self, value: i64) -> Self {
368        Self::new(views::badge(&self.handle, value))
369    }
370
371    /// Apply `.border(_:width:)` with a `Color` that is already built.
372    ///
373    /// For one of SwiftUI's named colours: `Color.gray` is semantic and no set of
374    /// components spells it. See `system_color`.
375    pub fn border_value(self, color: u64, width: f64) -> Self {
376        Self::new(views::border_value(&self.handle, color, width))
377    }
378
379    /// Apply `.buttonStyle(.glass(.clear))`.
380    ///
381    /// `.glass(_:)` is a static on a `PrimitiveButtonStyle` extension constrained
382    /// to `GlassButtonStyle` — the shape that has been inlinable every other time
383    /// in this file. This one is exported, which is only knowable by looking.
384    pub fn button_style_glass_clear(self) -> Self {
385        Self::new(views::button_style_glass_clear(&self.handle))
386    }
387
388    /// Apply `.clipShape(RoundedRectangle(cornerRadius:))`.
389    pub fn clip_rounded_rect(self, radius: f64) -> Self {
390        Self::new(views::clip_rounded_rect(&self.handle, radius))
391    }
392
393    /// Apply `.clipShape(RoundedRectangle(cornerRadius:style:))`.
394    ///
395    /// As with `super::rounded_rectangle_styled`, the style is not optional here
396    /// even though Swift source can leave it out: leaving it out means
397    /// `.continuous`, and writing case 0 builds the other shape.
398    pub fn clip_rounded_rect_styled(self, radius: f64, continuous: bool) -> Self {
399        Self::new(views::clip_rounded_rect_styled(&self.handle, radius, continuous))
400    }
401
402    /// Apply `.colorEffect(_:)` — recolours each pixel.
403    pub fn color_effect(self, shader: &crate::metal::Shader) -> Self {
404        Self::new(crate::metal::color_effect(&self.handle, shader))
405    }
406
407    /// Apply `.colorInvert(_:)`.
408    pub fn color_invert(self) -> Self {
409        Self::new(views::color_invert(&self.handle))
410    }
411
412    /// `confirmationDialog(…actions:message:)` with a fixed flag, which cannot be
413    /// dismissed — see `confirmation_dialog`.
414    pub fn confirmation_message(self, title: &str, actions: View, message: View, presented: bool) -> Self {
415        Self::new(views::confirmation_message(&self.handle, title, actions.handle(), message.handle(), presented))
416    }
417
418    /// `.containerValue(\.key, value)` for a key defined here.
419    ///
420    /// What the `@_alwaysEmitIntoClient` modifier's body does, since the modifier
421    /// itself exports no symbol: build a `_ContainerValueWritingModifier` and apply
422    /// it with `.modifier(_:)`.
423    pub fn container_value<T: crate::views::KeyValue>(self, key: &crate::views::CustomContainerKey<T>, value: impl crate::views::IntoKeyValue<T>) -> Self {
424        Self::new(views::container_value(&self.handle, key, value))
425    }
426
427    /// `.contentToolbar(for:content:)` — a toolbar attached to a container's
428    /// content rather than to the window.
429    ///
430    /// The `Content: View` overload, which is the one that takes an ordinary view
431    /// builder; the `ToolbarContent` overload is a different symbol.
432    ///
433    /// iOS only. See `ContentToolbarPlacement` — there is no macOS case to pass.
434    #[cfg(not(target_os = "macos"))]
435    pub fn content_toolbar(self, placement: crate::views::ContentToolbarPlacement, content: View) -> Self {
436        Self::new(views::content_toolbar(&self.handle, placement, content.handle()))
437    }
438
439    /// Apply `.cornerRadius(_:)`.
440    pub fn corner_radius(self, radius: f64) -> Self {
441        Self::new(views::corner_radius(&self.handle, radius))
442    }
443
444    /// `.animation(Animation(curve), value:)` with a curve written in Rust.
445    pub fn custom_animation(self, curve: &crate::views::CustomAnimationCurve, value: i64) -> Self {
446        Self::new(views::custom_animation(&self.handle, curve, value))
447    }
448
449    /// `.buttonStyle(_:)` with a style written in Rust.
450    pub fn custom_button_style(self, style: &crate::views::CustomButtonStyle) -> Self {
451        Self::new(views::custom_button_style(&self.handle, style))
452    }
453
454    /// `.labelStyle(_:)` with a style written in Rust.
455    pub fn custom_label_style(self, style: &crate::views::CustomLabelStyle) -> Self {
456        Self::new(views::custom_label_style(&self.handle, style))
457    }
458
459    /// `.modifier(_:)` with a modifier written in Rust.
460    ///
461    /// The result is `ModifiedContent<Self, RustModifier>` — a concrete type, not an
462    /// opaque one, because `modifier<T>(_:)` says so. `T` is unconstrained there, so
463    /// no witness table is passed at the call: SwiftUI finds the conformance by
464    /// lookup when it renders, which is exactly why registering it matters.
465    pub fn custom_modifier(self, modifier: &crate::views::CustomModifier) -> Self {
466        Self::new(views::custom_modifier(&self.handle, modifier))
467    }
468
469    /// `.transition(_:)` with a transition written in Rust.
470    ///
471    /// Wrapped in an `AnyTransition` on the way, because that is what
472    /// `transition<T: Transition>(_:)` does: it is `@_alwaysEmitIntoClient` and
473    /// exports no symbol, so the binding calls what its body calls.
474    pub fn custom_transition(self, transition: &crate::views::CustomTransition) -> Self {
475        Self::new(views::custom_transition(&self.handle, transition))
476    }
477
478    /// `.defaultHoverEffect(_:)` with the effect named.
479    ///
480    /// See `default_hover_effect_highlight` for why this is iOS-only.
481    #[cfg(not(target_os = "macos"))]
482    pub fn default_hover_effect(self, effect: crate::views::HoverEffect) -> Self {
483        Self::new(views::default_hover_effect(&self.handle, effect))
484    }
485
486    /// Apply `.defaultHoverEffect(_:)` with `.highlight`.
487    ///
488    /// Marked `@available(macOS, unavailable)`, which is a *source* restriction:
489    /// the compiler refuses the call, but `$s7SwiftUI4ViewPAAE18defaultHoverEffect…`
490    /// is in the export table all the same. Searching for the symbol and finding it
491    /// is not evidence the call works — the macOS implementation is a trap stub,
492    /// the same as `hoverEffect` next door — so this is compiled out there rather
493    /// than left to die at run time.
494    ///
495    /// The argument is `HoverEffect?`, and `HoverEffect` is resilient: `.highlight`
496    /// comes back through x8 and is then handed over by address.
497    #[cfg(not(target_os = "macos"))]
498    pub fn default_hover_effect_highlight(self) -> Self {
499        Self::new(views::default_hover_effect_highlight(&self.handle))
500    }
501
502    /// `.defersSystemGestures(on:)` — hold off the home indicator and Control Centre
503    /// swipes on the named edges.
504    ///
505    /// `Edge.Set` is an option set over one byte, read out of SwiftUI's own static
506    /// rather than written as a bitmask.
507    #[cfg(not(target_os = "macos"))]
508    pub fn defers_system_gestures(self, edges: crate::views::EdgeSet) -> Self {
509        Self::new(views::defers_system_gestures(&self.handle, edges))
510    }
511
512    /// Apply `.deleteDisabled(_:)`.
513    pub fn delete_disabled(self, value: bool) -> Self {
514        Self::new(views::delete_disabled(&self.handle, value))
515    }
516
517    /// Apply `.dialogIcon(_:)`.
518    pub fn dialog_icon(self, system_name: Option<&str>) -> Self {
519        Self::new(views::dialog_icon(&self.handle, system_name))
520    }
521
522    /// Apply `.dialogPreventsAppTermination(_:)`.
523    pub fn dialog_prevents_app_termination(self, prevents: Option<bool>) -> Self {
524        Self::new(views::dialog_prevents_app_termination(&self.handle, prevents))
525    }
526
527    pub fn dialog_severity(self, value: crate::views::DialogSeverity) -> Self {
528        Self::new(views::dialog_severity(&self.handle, value))
529    }
530
531    /// Apply `.dialogSuppressionToggle(isSuppressed:)`.
532    pub fn dialog_suppression_toggle(self, state: &crate::views::BoundState<bool>) -> Self {
533        Self::new(views::dialog_suppression_toggle(&self.handle, state))
534    }
535
536    /// Apply `.dialogSuppressionToggle(_:isSuppressed:)` with a label.
537    ///
538    /// Seven integer arguments — four for the key, three for the binding — so
539    /// `Self.Type` and the witness table travel on the stack rather than in
540    /// registers.
541    pub fn dialog_suppression_toggle_labelled(self, label: &str, state: &crate::views::BoundState<bool>) -> Self {
542        Self::new(views::dialog_suppression_toggle_labelled(&self.handle, label, state))
543    }
544
545    /// Apply `.disableAutocorrection(_:)`.
546    pub fn disable_autocorrection(self, disable: Option<bool>) -> Self {
547        Self::new(views::disable_autocorrection(&self.handle, disable))
548    }
549
550    /// Apply `.distortionEffect(_:maxSampleOffset:)` — warps geometry.
551    pub fn distortion_effect(self, shader: &crate::metal::Shader, max_w: f64, max_h: f64) -> Self {
552        Self::new(crate::metal::distortion_effect(&self.handle, shader, max_w, max_h))
553    }
554
555    /// Attach a `DragGesture`.
556    pub fn drag_gesture(self, minimum_distance: f64) -> Self {
557        Self::new(views::drag_gesture(&self.handle, minimum_distance))
558    }
559
560    /// Apply `.draggable(_:)` with a `String` payload.
561    ///
562    /// The overload everything else calls `draggable`: drag this view and a piece
563    /// of text comes out, droppable anywhere that takes one. The
564    /// `containerItemID:` binding next door is a different modifier for a
565    /// different job — reordering within a container.
566    ///
567    /// `String` because it is the `Transferable` conformer that needs no bridging:
568    /// its witness is exported from CoreTransferable, and its value is two loadable
569    /// words. A `Data` or a `URL` payload would each need their own.
570    pub fn draggable_text(self, text: &str) -> Self {
571        Self::new(views::draggable_text(&self.handle, text))
572    }
573
574    /// `.environment(model)` — put the model where every view below can read it.
575    ///
576    /// The `Observable` overload. A body that reads a property of the model through
577    /// `Model::get` while SwiftUI is tracking it is re-run when that property
578    /// changes; one that reads a *different* property is not.
579    pub fn environment_model(self, model: &crate::observable::Model) -> Self {
580        Self::new(crate::observable::environment_model(&self.handle, model))
581    }
582
583    /// `.environment(\.key, value)` for a key defined here.
584    pub fn environment_value<T: crate::views::KeyValue>(self, key: &crate::views::CustomEnvKey<T>, value: impl crate::views::IntoKeyValue<T>) -> Self {
585        Self::new(views::environment_value(&self.handle, key, value))
586    }
587
588    /// `.equatable()` — wrap a view in `EquatableView`, whatever its type.
589    ///
590    /// `equatable_text` does this for a `Text` and nothing else, because the
591    /// mangled name it resolves names `Text`. The constraint is
592    /// `Content: Equatable & View`, and whether a given type satisfies it is a
593    /// question the runtime can answer — so this asks, instead of the binding
594    /// deciding in advance which one type is allowed.
595    ///
596    /// The bound is genuine, not a limitation here: a view erased into `AnyView`
597    /// is not `Equatable` and cannot be made so. That is what the panic says, and
598    /// it is the same thing Swift's type checker would say at the call site.
599    ///
600    /// Wrapping is the whole of it — `equatable()` is `@inlinable` with the body
601    /// `EquatableView(content: self)`, and `EquatableView` stores only its
602    /// content, so the value is the content's own bytes copied through its value
603    /// witness. A raw `memcpy` would work for a `Text` and leak a reference for
604    /// anything holding one.
605    pub fn equatable(self) -> Self {
606        Self::new(views::equatable(&self.handle))
607    }
608
609    pub fn file_dialog_browser_options(self, value: crate::views::FileDialogBrowserOptions) -> Self {
610        Self::new(views::file_dialog_browser_options(&self.handle, value))
611    }
612
613    /// Apply `.fileDialogConfirmationLabel(_:)`.
614    pub fn file_dialog_confirmation_label(self, value: &str) -> Self {
615        Self::new(views::file_dialog_confirmation_label(&self.handle, value))
616    }
617
618    /// Apply `.fileDialogCustomizationID(_:)`.
619    pub fn file_dialog_customization_id(self, value: &str) -> Self {
620        Self::new(views::file_dialog_customization_id(&self.handle, value))
621    }
622
623    /// Apply `.fileDialogDefaultDirectory(_:)`.
624    pub fn file_dialog_default_directory(self, path: Option<&str>) -> Self {
625        Self::new(views::file_dialog_default_directory(&self.handle, path))
626    }
627
628    /// Apply `.fileDialogImportsUnresolvedAliases(_:)`.
629    pub fn file_dialog_imports_unresolved_aliases(self, value: bool) -> Self {
630        Self::new(views::file_dialog_imports_unresolved_aliases(&self.handle, value))
631    }
632
633    /// Apply `.fileDialogMessage(_:)`.
634    pub fn file_dialog_message(self, value: &str) -> Self {
635        Self::new(views::file_dialog_message(&self.handle, value))
636    }
637
638    /// Apply `.fileDialogURLEnabled(_:)`.
639    ///
640    /// The argument is a `Foundation.Predicate<Pack{URL}>`, which the `#Predicate`
641    /// macro normally builds from an expression tree at compile time. `Predicate`
642    /// also exposes `.true` and `.false` as statics, and those are values rather
643    /// than syntax — so they are reachable from here, where an arbitrary predicate
644    /// is not.
645    ///
646    /// The type is generic over a *parameter pack*, whose mangling closes with
647    /// `_QP` rather than directly; see `crate::mangle::pack`.
648    pub fn file_dialog_url_enabled(self, enabled: bool) -> Self {
649        Self::new(views::file_dialog_url_enabled(&self.handle, enabled))
650    }
651
652    /// Apply `.fileExporterFilenameLabel(_:)`.
653    pub fn file_exporter_filename_label(self, value: &str) -> Self {
654        Self::new(views::file_exporter_filename_label(&self.handle, value))
655    }
656
657    /// Apply `.findDisabled(_:)`.
658    pub fn find_disabled(self, value: bool) -> Self {
659        Self::new(views::find_disabled(&self.handle, value))
660    }
661
662    /// Apply `.flipsForRightToLeftLayoutDirection(_:)`.
663    pub fn flips_for_right_to_left_layout_direction(self, value: bool) -> Self {
664        Self::new(views::flips_for_right_to_left_layout_direction(&self.handle, value))
665    }
666
667    /// Apply `.focusEffectDisabled(_:)`.
668    pub fn focus_effect_disabled(self, value: bool) -> Self {
669        Self::new(views::focus_effect_disabled(&self.handle, value))
670    }
671
672    /// Apply `.focusSection(_:)`.
673    pub fn focus_section(self) -> Self {
674        Self::new(views::focus_section(&self.handle))
675    }
676
677    /// Apply `.focused(_:)` with a real, installed `@FocusState`.
678    ///
679    /// `focused` applies the same modifier with a `FocusState` built on the spot,
680    /// which is what SwiftUI stores either way but leaves nothing to read or move.
681    /// This takes the projection of a property SwiftUI has installed, so
682    /// `crate::state::ComposedView::focus` reports whether the field has focus
683    /// and `crate::state::ComposedView::set_focus` puts it there.
684    pub fn focused_on(self, projection: [u64; 3]) -> Self {
685        Self::new(views::focused_on(&self.handle, projection))
686    }
687
688    /// Apply `.focusedSceneObject(_:)`.
689    pub fn focused_scene_object(self) -> Self {
690        Self::new(views::focused_scene_object(&self.handle))
691    }
692
693    /// `.focusedSceneValue(keyPath, value)` — publish a value for the whole scene.
694    ///
695    /// What a window tells the menu bar about its selection. The scene form is the
696    /// one commands read; `focused_value_keyed` is the same thing scoped to
697    /// whatever currently has focus.
698    pub fn focused_scene_value<T: crate::views::KeyValue>(self, key: &crate::views::FocusKey<T>, value: impl crate::views::IntoKeyValue<T>) -> Self {
699        Self::new(views::focused_scene_value(&self.handle, key, value))
700    }
701
702    /// `.focusedValue(keyPath, value)` — publish a value for the focused view.
703    pub fn focused_value_keyed<T: crate::views::KeyValue>(self, key: &crate::views::FocusKey<T>, value: impl crate::views::IntoKeyValue<T>) -> Self {
704        Self::new(views::focused_value_keyed(&self.handle, key, value))
705    }
706
707    /// `.focusedValue(model)` — publish the model for the commands above it.
708    ///
709    /// The object form of what `crate::views::focused_scene_value` does with a key
710    /// path, and the one Apple now recommends: a key is a type, and an `@Observable`
711    /// object already is one.
712    pub fn focused_value_model(self, model: &crate::observable::Model) -> Self {
713        Self::new(crate::observable::focused_value_model(&self.handle, model))
714    }
715
716    /// Apply an already-built raw `Font` value with `.font(_:)`.
717    pub fn font_apply(self, font: u64) -> Self {
718        Self::new(views::font_apply(&self.handle, font))
719    }
720
721    /// Apply `.font(.custom(_:size:))`.
722    pub fn font_custom(self, name: &str, size: f64) -> Self {
723        Self::new(views::font_custom(&self.handle, name, size))
724    }
725
726    /// Apply `.font(.system(size:weight:design:))`.
727    pub fn font_system(self, size: f64, weight: Option<crate::views::Weight>, design: Option<crate::views::Design>) -> Self {
728        Self::new(views::font_system(&self.handle, size, weight, design))
729    }
730
731    /// Apply `.font(_:)` with one of the built-in text styles.
732    pub fn font_text_style(self, style: crate::views::TextStyle) -> Self {
733        Self::new(views::font_text_style(&self.handle, style))
734    }
735
736    /// Apply `.fontWeight(_:)`.
737    pub fn font_weight(self, weight: crate::views::Weight) -> Self {
738        Self::new(views::font_weight(&self.handle, weight))
739    }
740
741    /// Apply `.foregroundColor(_:)`.
742    pub fn foreground_color(self, color: Option<crate::Color>) -> Self {
743        Self::new(views::foreground_color(&self.handle, color))
744    }
745
746    /// Apply `.foregroundColor(_:)`, the deprecated environment-writing one.
747    ///
748    /// Not `foreground_style_color`: this produces
749    /// `_EnvironmentKeyWritingModifier<Color?>` and that produces
750    /// `_ForegroundStyleModifier<Color>`. They render the same.
751    /// Apply `.foregroundColor(_:)` to a `Color` that is already built.
752    ///
753    /// For one of SwiftUI's named colours, which no set of components can spell.
754    /// See `super::system_color`.
755    pub fn foreground_color_value(self, color: u64) -> Self {
756        Self::new(views::foreground_color_value(&self.handle, color))
757    }
758
759    /// Apply `.foregroundStyle(_:)` with a colour.
760    ///
761    /// Named for what it does, not for `.foregroundColor(_:)` — which is deprecated
762    /// and a different thing: it writes an environment key, producing
763    /// `_EnvironmentKeyWritingModifier<Color?>` where this produces
764    /// `_ForegroundStyleModifier<Color>`. The two render alike, so only a
765    /// type-level comparison tells them apart. See `foreground_color` for the
766    /// other one.
767    pub fn foreground_style_color(self, r: f64, g: f64, b: f64, a: f64) -> Self {
768        Self::new(views::foreground_style_color(&self.handle, r, g, b, a))
769    }
770
771    /// Apply `.foregroundStyle(.linearGradient(colors:startPoint:endPoint:))`.
772    ///
773    /// The shorthand in Swift source is a protocol-extension static marked
774    /// `@inlinable`, so it has no symbol; the `LinearGradient` it builds does.
775    /// Apply `.foregroundStyle(_:)` with one of the hierarchical levels —
776    /// `.secondary` and friends.
777    pub fn foreground_style_hierarchical(self, level: crate::views::Hierarchical) -> Self {
778        Self::new(views::foreground_style_hierarchical(&self.handle, level))
779    }
780
781    pub fn foreground_style_linear_gradient(self, colors: &[u64], start: (f64, f64), end: (f64, f64)) -> Self {
782        Self::new(views::foreground_style_linear_gradient(&self.handle, colors, start, end))
783    }
784
785    /// Apply `.foregroundStyle(_:_:)` — a primary and a secondary style.
786    ///
787    /// What `symbolRenderingMode(.palette)` needs: a palette symbol takes its
788    /// layers from successive styles, and with only one it renders as monochrome.
789    pub fn foreground_style_pair(self, primary: u64, secondary: u64) -> Self {
790        Self::new(views::foreground_style_pair(&self.handle, primary, secondary))
791    }
792
793    /// Apply `.foregroundStyle(_:_:_:)` — three styles.
794    ///
795    /// A palette symbol takes its layers from successive styles.
796    /// `foreground_style_pair` covers the two-layer symbols; the three-layer
797    /// ones — and there are plenty in SF Symbols — rendered their third layer in
798    /// the secondary colour, because there was no way to say what it should be.
799    ///
800    /// Eleven words of arguments, so three spill: the three style addresses and
801    /// `Self.Type` fill x0–x3, the three style types and the `Self: View` witness
802    /// take x4–x7, and all *three* `ShapeStyle` witnesses go to the stack.
803    ///
804    /// Spilling only two of them — which is easy to do, since the pair version next
805    /// door fits in eight words exactly and spills none — left the callee reading a
806    /// stale word as a witness table. It did not fault there: it faulted much later
807    /// inside `swift::MetadataCacheKey::operator==`, recursing on a type built from
808    /// the garbage, which is what an argument-count mistake looks like from the
809    /// outside.
810    pub fn foreground_style_triple(self, primary: u64, secondary: u64, tertiary: u64) -> Self {
811        Self::new(views::foreground_style_triple(&self.handle, primary, secondary, tertiary))
812    }
813
814    /// Apply `.foregroundStyle(_:)` to a `Color` that is already built.
815    ///
816    /// The components overload above cannot express `Color.blue`: SwiftUI's named
817    /// colours are semantic, not literal, and resolve per appearance — the aqua
818    /// `Color.blue` is nowhere near `(0, 0, 1)`. This takes the value a static
819    /// getter handed back instead. See `super::system_color`.
820    pub fn foreground_style_value(self, color: u64) -> Self {
821        Self::new(views::foreground_style_value(&self.handle, color))
822    }
823
824    /// Apply `.frame(maxWidth:maxHeight:alignment:)` with `.infinity` for both.
825    ///
826    /// Six `Optional<CGFloat>`s — min, ideal and max for each axis — then an
827    /// `Alignment`, then the two generic words. Each optional is payload and tag,
828    /// so that is sixteen words in all: x0 through x7 carry the first four
829    /// optionals and the remaining eight go on the stack. The generic arguments
830    /// come *after* every formal parameter, which is what makes them spill; putting
831    /// them in x6 and x7 builds a frame out of the metadata pointers.
832    pub fn frame_max_infinity(self, alignment: crate::views::Alignment) -> Self {
833        Self::new(views::frame_max_infinity(&self.handle, alignment))
834    }
835
836    /// Apply `.frame(maxWidth: .infinity)` — the *width* only.
837    ///
838    /// Not `frame_max_infinity`, which sets both axes. Swift's
839    /// `.frame(maxWidth: .infinity)` leaves `maxHeight` nil, so the view keeps its
840    /// content's height; setting both stretched a card to fill its canvas and moved
841    /// everything in it.
842    ///
843    /// Six `Optional<CGFloat>`s — min, ideal and max for each axis — then an
844    /// `Alignment`, then the two generic words. Each optional is payload and tag,
845    /// so that is sixteen words in all: x0 through x7 carry the first four
846    /// optionals and the remaining eight go on the stack. The generic arguments
847    /// come *after* every formal parameter, which is what makes them spill; putting
848    /// them in x6 and x7 builds a frame out of the metadata pointers.
849    pub fn frame_max_width(self, alignment: crate::views::Alignment) -> Self {
850        Self::new(views::frame_max_width(&self.handle, alignment))
851    }
852
853    /// `.fullScreenCover(isPresented:onDismiss:content:)` with a fixed flag.
854    ///
855    /// As with `super::sheet`, a constant binding is read-only: the cover cannot
856    /// dismiss itself, because there is nowhere for SwiftUI to write `false`. Use
857    /// `full_screen_cover_bound` for one the user can close.
858    #[cfg(not(target_os = "macos"))]
859    pub fn full_screen_cover(self, content: View, presented: bool) -> Self {
860        Self::new(views::full_screen_cover(&self.handle, content.handle(), presented))
861    }
862
863    /// `.fullScreenCover` bound to Rust state, so dismissing it writes `false` back.
864    #[cfg(not(target_os = "macos"))]
865    pub fn full_screen_cover_bound(self, content: View, state: &crate::views::BoundState<bool>) -> Self {
866        Self::new(views::full_screen_cover_bound(&self.handle, content.handle(), state))
867    }
868
869    /// `.fullScreenCover` with the `onDismiss:` closure spelled out.
870    #[cfg(not(target_os = "macos"))]
871    pub fn full_screen_cover_bound_dismiss(self, content: View, state: &crate::views::BoundState<bool>, on_dismiss: impl Fn() + 'static) -> Self {
872        Self::new(views::full_screen_cover_bound_dismiss(&self.handle, content.handle(), state, on_dismiss))
873    }
874
875    /// `.gesture(_:including:)`.
876    pub fn gesture<V: crate::views::GestureData>(self, g: &crate::views::GestureValue<V>, mask: crate::views::GestureMask) -> Self {
877        Self::new(views::gesture(&self.handle, g, mask))
878    }
879
880    /// Apply `.glassEffect()` — Liquid Glass, in its default shape.
881    ///
882    /// The result type is a `StaticIf<GlassEnabledPredicate, ...>`: SwiftUI picks
883    /// between the glass-modified view and the original at runtime depending on
884    /// whether the platform has Liquid Glass enabled.
885    pub fn glass_effect(self) -> Self {
886        Self::new(views::glass_effect(&self.handle))
887    }
888
889    /// Apply `.glassEffectID(_:in:)`.
890    pub fn glass_effect_id<'h>(self, id: Option<impl crate::views::IntoHashable<'h>>) -> Self {
891        Self::new(views::glass_effect_id(&self.handle, id.map(crate::views::IntoHashable::into_hashable)))
892    }
893
894    /// The same, with the variant named.
895    ///
896    /// `Identity` is the no-op: it still builds the `StaticIf`, so the view's type
897    /// is the one a glass effect gives it, with nothing drawn. That is what makes
898    /// it usable as the "off" end of a condition without the two branches
899    /// disagreeing about their type.
900    pub fn glass_effect_kind(self, glass: crate::views::Glass) -> Self {
901        Self::new(views::glass_effect_kind(&self.handle, glass))
902    }
903
904    pub fn glass_effect_transition(self, value: crate::views::GlassEffectTransition) -> Self {
905        Self::new(views::glass_effect_transition(&self.handle, value))
906    }
907
908    /// Apply `.glassEffectUnion(id:namespace:)`.
909    pub fn glass_effect_union<'h>(self, id: Option<impl crate::views::IntoHashable<'h>>) -> Self {
910        Self::new(views::glass_effect_union(&self.handle, id.map(crate::views::IntoHashable::into_hashable)))
911    }
912
913    /// Apply `.gridCellColumns(_:)`.
914    pub fn grid_cell_columns(self, value: i64) -> Self {
915        Self::new(views::grid_cell_columns(&self.handle, value))
916    }
917
918    /// Apply `.help(_:)`.
919    pub fn help(self, value: &str) -> Self {
920        Self::new(views::help(&self.handle, value))
921    }
922
923    /// Apply `.help(_:)`.
924    pub fn help_text(self, value: &str) -> Self {
925        Self::new(views::help_text(&self.handle, value))
926    }
927
928    /// `.highPriorityGesture(_:including:)` — this gesture wins over the view's own.
929    pub fn high_priority_gesture_of<V: crate::views::GestureData>(self, g: &crate::views::GestureValue<V>, mask: crate::views::GestureMask) -> Self {
930        Self::new(views::high_priority_gesture_of(&self.handle, g, mask))
931    }
932
933    /// Apply `.horizontalRadioGroupLayout(_:)`.
934    pub fn horizontal_radio_group_layout(self) -> Self {
935        Self::new(views::horizontal_radio_group_layout(&self.handle))
936    }
937
938    /// Apply `.hoverEffect()` — the effect a bare call means, which is
939    /// `AutomaticHoverEffect`.
940    ///
941    /// Not available on macOS, for the reason `hover_effect_lift` gives.
942    #[cfg(not(target_os = "macos"))]
943    pub fn hover_effect_automatic(self) -> Self {
944        Self::new(views::hover_effect_automatic(&self.handle))
945    }
946
947    /// `.indexViewStyle(PageIndexViewStyle(backgroundDisplayMode:))` — the page dots
948    /// under a paged `TabView`.
949    ///
950    /// iOS only. `PageIndexViewStyle` is the only `IndexViewStyle` SwiftUI ships, so
951    /// there is nothing to choose between — what there *is* to choose is when the
952    /// dots get a backdrop, which is the argument.
953    #[cfg(not(target_os = "macos"))]
954    pub fn index_view_style_page(self, background: crate::views::IndexBackground) -> Self {
955        Self::new(views::index_view_style_page(&self.handle, background))
956    }
957
958    /// Apply `.interactionActivityTrackingTag(_:)`.
959    pub fn interaction_activity_tracking_tag(self, value: &str) -> Self {
960        Self::new(views::interaction_activity_tracking_tag(&self.handle, value))
961    }
962
963    /// Apply `.interactiveDismissDisabled(_:)`.
964    pub fn interactive_dismiss_disabled(self, value: bool) -> Self {
965        Self::new(views::interactive_dismiss_disabled(&self.handle, value))
966    }
967
968    /// Apply `.invalidatableContent(_:)`.
969    pub fn invalidatable_content(self, value: bool) -> Self {
970        Self::new(views::invalidatable_content(&self.handle, value))
971    }
972
973    /// `.keyboardType(_:)`.
974    #[cfg(not(target_os = "macos"))]
975    pub fn keyboard_type(self, kind: crate::views::KeyboardType) -> Self {
976        Self::new(views::keyboard_type(&self.handle, kind))
977    }
978
979    /// Apply `.labelIconToTitleSpacing(_:)`.
980    pub fn label_icon_to_title_spacing(self, value: f64) -> Self {
981        Self::new(views::label_icon_to_title_spacing(&self.handle, value))
982    }
983
984    /// Apply `.labelReservedIconWidth(_:)`.
985    pub fn label_reserved_icon_width(self, value: f64) -> Self {
986        Self::new(views::label_reserved_icon_width(&self.handle, value))
987    }
988
989    /// Apply `.labelsHidden(_:)`.
990    pub fn labels_hidden(self) -> Self {
991        Self::new(views::labels_hidden(&self.handle))
992    }
993
994    /// Apply `.layerEffect(_:maxSampleOffset:)` — can sample neighbouring pixels.
995    pub fn layer_effect(self, shader: &crate::metal::Shader, max_w: f64, max_h: f64) -> Self {
996        Self::new(crate::metal::layer_effect(&self.handle, shader, max_w, max_h))
997    }
998
999    /// Apply `.layoutPriority(_:)`.
1000    pub fn layout_priority(self, value: f64) -> Self {
1001        Self::new(views::layout_priority(&self.handle, value))
1002    }
1003
1004    /// Apply `.layoutValue(key:value:)` with a runtime-synthesized key.
1005    ///
1006    /// A second protocol through the same machinery as `preference_int`, to show
1007    /// nothing about it is specific to `PreferenceKey`.
1008    pub fn layout_value_int(self, value: i64) -> Self {
1009        Self::new(views::layout_value_int(&self.handle, value))
1010    }
1011
1012    /// Apply `.listItemTint(_:)`.
1013    ///
1014    /// `None` clears the tint, which is the `nil` the modifier's `ListItemTint?`
1015    /// parameter takes.
1016    pub fn list_item_tint(self, tint: Option<crate::views::ListItemTint>) -> Self {
1017        Self::new(views::list_item_tint(&self.handle, tint))
1018    }
1019
1020    /// Attach a `LongPressGesture` with `.gesture(_:including:)`.
1021    pub fn long_press_gesture(self, duration: f64, max_distance: f64) -> Self {
1022        Self::new(views::long_press_gesture(&self.handle, duration, max_distance))
1023    }
1024
1025    /// Apply `.luminanceToAlpha(_:)`.
1026    pub fn luminance_to_alpha(self) -> Self {
1027        Self::new(views::luminance_to_alpha(&self.handle))
1028    }
1029
1030    /// Attach a `MagnifyGesture`.
1031    pub fn magnify_gesture(self, minimum_scale_delta: f64) -> Self {
1032        Self::new(views::magnify_gesture(&self.handle, minimum_scale_delta))
1033    }
1034
1035    /// Apply `.minimumScaleFactor(_:)`.
1036    pub fn minimum_scale_factor(self, value: f64) -> Self {
1037        Self::new(views::minimum_scale_factor(&self.handle, value))
1038    }
1039
1040    /// Apply `.monospacedDigit(_:)`.
1041    pub fn monospaced_digit(self) -> Self {
1042        Self::new(views::monospaced_digit(&self.handle))
1043    }
1044
1045    /// Apply `.moveDisabled(_:)`.
1046    pub fn move_disabled(self, value: bool) -> Self {
1047        Self::new(views::move_disabled(&self.handle, value))
1048    }
1049
1050    /// Apply `.multilineTextAlignment(_:)`.
1051    pub fn multiline_alignment(self, align: crate::views::TextAlign) -> Self {
1052        Self::new(views::multiline_alignment(&self.handle, align))
1053    }
1054
1055    /// Apply `.navigationBarBackButtonHidden(_:)`.
1056    pub fn navigation_bar_back_button_hidden(self, value: bool) -> Self {
1057        Self::new(views::navigation_bar_back_button_hidden(&self.handle, value))
1058    }
1059
1060    /// `.navigationBarHidden(_:)`.
1061    #[cfg(not(target_os = "macos"))]
1062    pub fn navigation_bar_hidden(self, hidden: bool) -> Self {
1063        Self::new(views::navigation_bar_hidden(&self.handle, hidden))
1064    }
1065
1066    /// `.navigationBarTitleDisplayMode(_:)`.
1067    ///
1068    /// The mode is a resilient enum, so it goes by address and its tag is read from
1069    /// reflection rather than written down — see `abi::enum_case_index`.
1070    #[cfg(not(target_os = "macos"))]
1071    pub fn navigation_bar_title_display_mode(self, mode: crate::views::TitleDisplayMode) -> Self {
1072        Self::new(views::navigation_bar_title_display_mode(&self.handle, mode))
1073    }
1074
1075    /// Apply `.navigationSplitViewStyle(_:)`.
1076    pub fn navigation_split_view_style(self, style: crate::views::SplitViewStyle) -> Self {
1077        Self::new(views::navigation_split_view_style(&self.handle, style))
1078    }
1079
1080    /// Apply `.navigationSubtitle(_:)`.
1081    pub fn navigation_subtitle(self, value: &str) -> Self {
1082        Self::new(views::navigation_subtitle(&self.handle, value))
1083    }
1084
1085    /// Apply `.navigationSubtitle(_:)`.
1086    pub fn navigation_subtitle_text(self, value: &str) -> Self {
1087        Self::new(views::navigation_subtitle_text(&self.handle, value))
1088    }
1089
1090    /// `.navigationViewStyle(.columns)` — the two-column split.
1091    ///
1092    /// The witness is looked up at run time rather than named: a
1093    /// `NavigationViewStyle` conformance mangles its substitutions against the
1094    /// words in its *own* type name, so `ColumnNavigationViewStyle`'s is not
1095    /// `DefaultNavigationViewStyle`'s with a letter changed. Copying one has
1096    /// produced a witness for the wrong protocol in this crate before.
1097    pub fn navigation_view_style_columns(self) -> Self {
1098        Self::new(views::navigation_view_style_columns(&self.handle))
1099    }
1100
1101    /// `.navigationViewStyle(.doubleColumn)` — sidebar plus detail.
1102    pub fn navigation_view_style_double_column(self) -> Self {
1103        Self::new(views::navigation_view_style_double_column(&self.handle))
1104    }
1105
1106    /// `.navigationViewStyle(.stack)` — one view at a time, pushed and popped.
1107    ///
1108    /// `@available(macOS, unavailable)`, so iOS only.
1109    #[cfg(not(target_os = "macos"))]
1110    pub fn navigation_view_style_stack(self) -> Self {
1111        Self::new(views::navigation_view_style_stack(&self.handle))
1112    }
1113
1114    /// Apply `.onContinuousHover(coordinateSpace:perform:)`.
1115    pub fn on_continuous_hover(self, space: crate::views::CoordinateSpace, perform: impl Fn(crate::views::HoverPhase) + 'static) -> Self {
1116        Self::new(views::on_continuous_hover(&self.handle, space, perform))
1117    }
1118
1119    /// The same, with the value SwiftUI delivered.
1120    ///
1121    /// `on_drag_gesture`'s handler is told only *that* a drag ended. This one is
1122    /// told where it started, where it finished and how fast it was going — see
1123    /// `DragValue`.
1124    pub fn on_drag_ended_value(self, minimum_distance: f64, action: impl Fn(crate::views::DragValue) + 'static) -> Self {
1125        Self::new(views::on_drag_ended_value(&self.handle, minimum_distance, action))
1126    }
1127
1128    /// Attach a `DragGesture` with an `onEnded` handler.
1129    ///
1130    /// `drag_gesture` attaches a bare `DragGesture` with nothing listening, which
1131    /// builds the same value Swift would but can never be seen to fire. This wires
1132    /// the action SwiftUI calls when the drag ends, so the gesture is observable.
1133    ///
1134    /// The result type is taken from `.gesture`'s opaque-result-type descriptor
1135    /// rather than a hand-written mangling: the type is
1136    /// `ModifiedContent<AnyView, AddGestureModifier<_EndedGesture<DragGesture>, _>>`,
1137    /// and spelling that out by hand is how earlier bindings resolved to null.
1138    pub fn on_drag_gesture(self, minimum_distance: f64, action: impl Fn() + 'static) -> Self {
1139        Self::new(views::on_drag_gesture(&self.handle, minimum_distance, action))
1140    }
1141
1142    /// Apply `.onLongPressGesture(minimumDuration:maximumDistance:pressing:perform:)`.
1143    ///
1144    /// Unlike `long_press_gesture`, which attaches a bare `LongPressGesture` with
1145    /// nothing listening, this takes the action SwiftUI runs when the press
1146    /// completes — so the gesture can be observed rather than only built.
1147    pub fn on_long_press_gesture(self, duration: f64, max_distance: f64, action: impl Fn() + 'static) -> Self {
1148        Self::new(views::on_long_press_gesture(&self.handle, duration, max_distance, action))
1149    }
1150
1151    /// Attach a `MagnifyGesture` with an `onEnded` handler.
1152    pub fn on_magnify_ended(self, minimum_scale_delta: f64, action: impl Fn(crate::views::MagnifyValue) + 'static) -> Self {
1153        Self::new(views::on_magnify_ended(&self.handle, minimum_scale_delta, action))
1154    }
1155
1156    /// Apply `.onPencilDoubleTap(perform:)`.
1157    pub fn on_pencil_double_tap(self, action: impl Fn() + 'static) -> Self {
1158        Self::new(views::on_pencil_double_tap(&self.handle, action))
1159    }
1160
1161    /// Apply `.onPencilSqueeze(perform:)`.
1162    pub fn on_pencil_squeeze(self, action: impl Fn() + 'static) -> Self {
1163        Self::new(views::on_pencil_squeeze(&self.handle, action))
1164    }
1165
1166    /// Apply `.onPreferenceChange(_:perform:)`, recording the value.
1167    ///
1168    /// The value is read back through `observed_preference`. `K.Value` must also
1169    /// be `Equatable` here, so the call carries two witness tables for the one
1170    /// generic parameter.
1171    pub fn on_preference_change_int(self) -> Self {
1172        Self::new(views::on_preference_change_int(&self.handle))
1173    }
1174
1175    /// Attach a `RotateGesture` with an `onEnded` handler.
1176    pub fn on_rotate_ended(self, minimum_degrees: f64, action: impl Fn(crate::views::RotateValue) + 'static) -> Self {
1177        Self::new(views::on_rotate_ended(&self.handle, minimum_degrees, action))
1178    }
1179
1180    /// Apply `.onTapGesture(count:perform:)`.
1181    /// The action may capture, as `super::button`'s may — a tap handler that
1182    /// cannot know which row it is on is one every list has to route around.
1183    pub fn on_tap_gesture(self, count: i64, action: impl Fn() + 'static) -> Self {
1184        Self::new(views::on_tap_gesture(&self.handle, count, action))
1185    }
1186
1187    /// `.padding(_: EdgeInsets)` — a different inset per edge.
1188    ///
1189    /// `padding_set` takes one length for a set of edges; this takes four. The
1190    /// insets go in d0–d3, being a homogeneous float aggregate.
1191    pub fn padding_insets(self, insets: crate::views::EdgeInsets) -> Self {
1192        Self::new(views::padding_insets(&self.handle, insets))
1193    }
1194
1195    /// Apply `.padding(_:_:)` — chosen edges, an explicit length.
1196    ///
1197    /// `edges` is an `Edge.Set` bit pattern: 1 top, 2 leading, 4 bottom, 8 trailing,
1198    /// so `.vertical` is 5 and `.all` is 15. A `None` length means the system's own
1199    /// inset, as in `padding_default`.
1200    /// `.padding(_:_:)` with the edges named rather than spelled as a bitmask.
1201    ///
1202    /// `padding_edges` takes the raw option-set bits, which a caller has to know;
1203    /// this reads the member out of SwiftUI's own `Edge.Set` instead.
1204    pub fn padding_set(self, edges: crate::views::EdgeSet, length: Option<f64>) -> Self {
1205        Self::new(views::padding_set(&self.handle, edges, length))
1206    }
1207
1208    /// Apply `.preference(key:value:)` with a runtime-synthesized key.
1209    ///
1210    /// The key type carries a `PreferenceKey` conformance built by
1211    /// `crate::conformance` at run time, and its `Value` is `Int`. No Swift
1212    /// source declares it, which is the whole point: this is the one family of
1213    /// modifiers that expects the *client* to supply a conformance.
1214    pub fn preference_int(self, value: i64) -> Self {
1215        Self::new(views::preference_int(&self.handle, value))
1216    }
1217
1218    /// Apply `.preferredColorScheme(_:)` — light or dark for this subtree.
1219    pub fn preferred_color_scheme(self, scheme: crate::views::ColorScheme) -> Self {
1220        Self::new(views::preferred_color_scheme(&self.handle, scheme))
1221    }
1222
1223    /// Apply `.presentedWindowStyle(_:)`.
1224    pub fn presented_window_style(self, style: crate::views::WindowStyle) -> Self {
1225        Self::new(views::presented_window_style(&self.handle, style))
1226    }
1227
1228    /// Apply `.presentedWindowToolbarStyle(_:)`.
1229    pub fn presented_window_toolbar_style(self, style: crate::views::WindowToolbarStyle) -> Self {
1230        Self::new(views::presented_window_toolbar_style(&self.handle, style))
1231    }
1232
1233    /// Apply `.previewContext(_:)`.
1234    pub fn preview_context(self) -> Self {
1235        Self::new(views::preview_context(&self.handle))
1236    }
1237
1238    /// Apply `.previewDevice(_:)`.
1239    pub fn preview_device(self, name: Option<&str>) -> Self {
1240        Self::new(views::preview_device(&self.handle, name))
1241    }
1242
1243    /// Apply `.previewDisplayName(_:)`.
1244    pub fn preview_display_name(self, name: Option<&str>) -> Self {
1245        Self::new(views::preview_display_name(&self.handle, name))
1246    }
1247
1248    pub fn preview_interface_orientation(self, value: crate::views::InterfaceOrientation) -> Self {
1249        Self::new(views::preview_interface_orientation(&self.handle, value))
1250    }
1251
1252    /// Apply `.previewLayout(_:)`.
1253    pub fn preview_layout(self, layout: crate::views::PreviewLayout) -> Self {
1254        Self::new(views::preview_layout(&self.handle, layout))
1255    }
1256
1257    /// Apply `.privacySensitive(_:)`.
1258    pub fn privacy_sensitive(self, value: bool) -> Self {
1259        Self::new(views::privacy_sensitive(&self.handle, value))
1260    }
1261
1262    /// Apply `.progressViewStyle(_:)`.
1263    ///
1264    /// Not missing after all. Searching the export table for `progressViewStyle`
1265    /// finds nothing because the mangling compresses `ViewStyle` to
1266    /// `08progressC5Style` — `C` substitutes the `View` of the enclosing
1267    /// `SwiftUI.View` — so the spelled-out name never appears. The SIL for one line
1268    /// of Swift names it outright.
1269    ///
1270    /// `.linear` and `.automatic` are `@_alwaysEmitIntoClient` statics with no
1271    /// symbol of their own; the structs they return have plain initialisers, which
1272    /// is what this needs.
1273    pub fn progress_view_style(self, style: crate::views::ProgressStyle) -> Self {
1274        Self::new(views::progress_view_style(&self.handle, style))
1275    }
1276
1277    /// Apply `.replaceDisabled(_:)`.
1278    pub fn replace_disabled(self, value: bool) -> Self {
1279        Self::new(views::replace_disabled(&self.handle, value))
1280    }
1281
1282    /// Attach a `RotateGesture`. The minimum delta is an `Angle`, i.e. radians.
1283    pub fn rotate_gesture(self, minimum_degrees: f64) -> Self {
1284        Self::new(views::rotate_gesture(&self.handle, minimum_degrees))
1285    }
1286
1287    /// Apply `.rotationEffect(.degrees(_), anchor:)`.
1288    pub fn rotation(self, degrees: f64, anchor_x: f64, anchor_y: f64) -> Self {
1289        Self::new(views::rotation(&self.handle, degrees, anchor_x, anchor_y))
1290    }
1291
1292    /// Apply `.rotation3DEffect(_:axis:)`.
1293    pub fn rotation_3d(self, degrees: f64, ax: f64, ay: f64, az: f64) -> Self {
1294        Self::new(views::rotation_3d(&self.handle, degrees, ax, ay, az))
1295    }
1296
1297    /// Apply `.scaledToFill(_:)`.
1298    pub fn scaled_to_fill(self) -> Self {
1299        Self::new(views::scaled_to_fill(&self.handle))
1300    }
1301
1302    /// Apply `.scaledToFit(_:)`.
1303    pub fn scaled_to_fit(self) -> Self {
1304        Self::new(views::scaled_to_fit(&self.handle))
1305    }
1306
1307    /// Apply `.scenePadding(_:)`.
1308    pub fn scene_padding(self, v0: crate::views::ScenePadding, v1: crate::views::EdgeSet) -> Self {
1309        Self::new(views::scene_padding(&self.handle, v0, v1))
1310    }
1311
1312    /// Apply `.scrollClipDisabled(_:)`.
1313    pub fn scroll_clip_disabled(self, value: bool) -> Self {
1314        Self::new(views::scroll_clip_disabled(&self.handle, value))
1315    }
1316
1317    /// Apply `.scrollDisabled(_:)`.
1318    pub fn scroll_disabled(self, value: bool) -> Self {
1319        Self::new(views::scroll_disabled(&self.handle, value))
1320    }
1321
1322    /// `.scrollPosition(_:anchor:)` — scroll to an edge, and stay bound to it.
1323    ///
1324    /// `scroll_position_id` is the other overload, which scrolls to a row by its
1325    /// identity. This one takes a whole `ScrollPosition`, which is what
1326    /// "scrolled to the top" is: there is no row to name.
1327    ///
1328    /// The position lives in the binding for the life of the view. SwiftUI writes
1329    /// back as the user scrolls, so it has to be somewhere that outlives the call
1330    /// that made it.
1331    pub fn scroll_position_edge(self, edge: crate::views::Edge) -> Self {
1332        Self::new(views::scroll_position_edge(&self.handle, edge))
1333    }
1334
1335    /// Apply `.searchCompletion(_:)`.
1336    pub fn search_completion(self, value: &str) -> Self {
1337        Self::new(views::search_completion(&self.handle, value))
1338    }
1339
1340    /// `.signInWithAppleButtonStyle(_:)`.
1341    ///
1342    /// Declared on `View` in the overlay, so its mangled name says `SwiftUI.View`
1343    /// with the overlay as the extension's module — which is why it resolves in the
1344    /// overlay's image and not in SwiftUI's.
1345    pub fn sign_in_with_apple_button_style(self, style: crate::views::AppleButtonStyle) -> Self {
1346        Self::new(views::sign_in_with_apple_button_style(&self.handle, style))
1347    }
1348
1349    /// `.simultaneousGesture(_:including:)` — both this and the view's own run.
1350    pub fn simultaneous_gesture_of<V: crate::views::GestureData>(self, g: &crate::views::GestureValue<V>, mask: crate::views::GestureMask) -> Self {
1351        Self::new(views::simultaneous_gesture_of(&self.handle, g, mask))
1352    }
1353
1354    /// Apply `.speechAdjustedPitch(_:)`.
1355    pub fn speech_adjusted_pitch(self, value: f64) -> Self {
1356        Self::new(views::speech_adjusted_pitch(&self.handle, value))
1357    }
1358
1359    /// Apply `.speechAlwaysIncludesPunctuation(_:)`.
1360    pub fn speech_always_includes_punctuation(self, value: bool) -> Self {
1361        Self::new(views::speech_always_includes_punctuation(&self.handle, value))
1362    }
1363
1364    /// Apply `.speechAnnouncementsQueued(_:)`.
1365    pub fn speech_announcements_queued(self, value: bool) -> Self {
1366        Self::new(views::speech_announcements_queued(&self.handle, value))
1367    }
1368
1369    /// Apply `.speechSpellsOutCharacters(_:)`.
1370    pub fn speech_spells_out_characters(self, value: bool) -> Self {
1371        Self::new(views::speech_spells_out_characters(&self.handle, value))
1372    }
1373
1374    /// `.statusBarHidden(_:)`.
1375    ///
1376    /// Reached through `statusBar(hidden:)`. `statusBarHidden` is
1377    /// `@_alwaysEmitIntoClient`, so it exports no symbol of its own — its body is
1378    /// this call, which is what a Swift caller compiles to.
1379    #[cfg(not(target_os = "macos"))]
1380    pub fn status_bar_hidden(self, hidden: bool) -> Self {
1381        Self::new(views::status_bar_hidden(&self.handle, hidden))
1382    }
1383
1384    /// Apply `.submitScope(_:)`.
1385    pub fn submit_scope(self, value: bool) -> Self {
1386        Self::new(views::submit_scope(&self.handle, value))
1387    }
1388
1389    /// Apply `.symbolColorRenderingMode(_:)`.
1390    pub fn symbol_color_rendering_mode(self, mode: crate::views::SymbolColorRendering) -> Self {
1391        Self::new(views::symbol_color_rendering_mode(&self.handle, mode))
1392    }
1393
1394    /// `.symbolEffect(_:)` with any of the indefinite effects.
1395    ///
1396    /// The case tag is *read* from the enum's reflection rather than written down:
1397    /// `SymbolEffectConfiguration.Effect` numbers its cases in declaration order,
1398    /// which is not the order the documentation lists them — `.variableColor` is 2
1399    /// and `.scale` is 3, where reading down the page would say otherwise. A wrong
1400    /// tag builds a valid value of the wrong case, which renders, and renders
1401    /// wrongly. See `abi::enum_case_index`.
1402    pub fn symbol_effect(self, effect: crate::views::SymbolEffect) -> Self {
1403        Self::new(views::symbol_effect(&self.handle, effect))
1404    }
1405
1406    /// Apply `.symbolVariableValueMode(_:)`.
1407    pub fn symbol_variable_value_mode(self, mode: crate::views::SymbolVariableValue) -> Self {
1408        Self::new(views::symbol_variable_value_mode(&self.handle, mode))
1409    }
1410
1411    /// `.tabViewCustomization(_:)` with a live customization, not `nil`.
1412    ///
1413    /// `tab_view_customization_none` passes `nil`, which is the "do not persist
1414    /// anything" case and the only one that needed no value. This builds a real
1415    /// `TabViewCustomization` and hands SwiftUI a binding to it, so the user's
1416    /// reordering and hiding of tabs is kept — the whole point of the modifier.
1417    ///
1418    /// The value lives in the binding's closures for the life of the process: a
1419    /// customization SwiftUI can write back to has to outlive the call that made
1420    /// it, and there is nowhere else to put it.
1421    pub fn tab_view_customization(self) -> Self {
1422        Self::new(views::tab_view_customization(&self.handle))
1423    }
1424
1425    /// `.tabViewSearchActivation(_:)`.
1426    pub fn tab_view_search_activation(self, activation: crate::views::TabSearchActivation) -> Self {
1427        Self::new(views::tab_view_search_activation(&self.handle, activation))
1428    }
1429
1430    /// Apply `.tabViewStyle(_:)`.
1431    pub fn tab_view_style(self, style: crate::views::TabStyle) -> Self {
1432        Self::new(views::tab_view_style(&self.handle, style))
1433    }
1434
1435    /// Apply `.task { … }` — the spelling with no `id:`.
1436    ///
1437    /// A different modifier from `task`, not a default-argument version of it:
1438    /// that one builds `_TaskValueModifier2<ID>` and re-runs when the id changes,
1439    /// this one builds `_TaskModifier2` and runs once. `_TaskModifier2` is not
1440    /// generic, so there are no generic words to spill.
1441    ///
1442    /// The `name` carries the call site — SwiftUI records `View.task @ file:line` —
1443    /// so a value comparison against a reference only agrees if the caller passes
1444    /// the reference's own file and line, which is why they are parameters.
1445    pub fn task_once(self, priority: crate::views::TaskPriority, file: &str, line: i64, action: impl Fn() + Send + Sync + 'static) -> Self {
1446        Self::new(views::task_once(&self.handle, priority, file, line, action))
1447    }
1448
1449    /// `Text.baselineOffset(_:)`
1450    pub fn text_baseline_offset(self, amount: f64) -> Self {
1451        Self::new(views::text_baseline_offset(&self.handle, amount))
1452    }
1453
1454    /// `Text.bold()` — the one that returns `Text`.
1455    ///
1456    /// Returns the `View` extension's result if this is not a `Text`: that is what a
1457    /// caller wants there, and it is what every one of these used to do.
1458    pub fn text_bold(self) -> Self {
1459        Self::new(views::text_bold(&self.handle))
1460    }
1461
1462    /// `Text.font(_:)` — the overload that returns `Text`.
1463    ///
1464    /// `Text("x").font(.body).bold()` stays a `Text` all the way through in Swift
1465    /// precisely because this returns one; going through the `View` extension for
1466    /// the font is what made the rest of the chain fall back to the environment
1467    /// forms. `None` clears the font.
1468    pub fn text_font(self, font: Option<&crate::views::Font>) -> Self {
1469        Self::new(views::text_font(&self.handle, font))
1470    }
1471
1472    /// `Text.fontWeight(_:)` — the overload that returns `Text`.
1473    ///
1474    /// `Font.Weight?` lowers to two words, a payload and a tag, which land ahead of
1475    /// `self` — so this is the one shape the single-word helper cannot serve.
1476    /// `None` clears the weight.
1477    pub fn text_font_weight(self, weight: Option<crate::views::Weight>) -> Self {
1478        Self::new(views::text_font_weight(&self.handle, weight))
1479    }
1480
1481    /// `Text.foregroundColor(_:)` — the overload that returns `Text`.
1482    pub fn text_foreground_color(self, color: crate::Color) -> Self {
1483        Self::new(views::text_foreground_color(&self.handle, color))
1484    }
1485
1486    /// `Text.foregroundStyle(_:)` with one of the hierarchical styles.
1487    pub fn text_foreground_hierarchical(self, level: crate::views::Hierarchical) -> Self {
1488        Self::new(views::text_foreground_hierarchical(&self.handle, level))
1489    }
1490
1491    /// `Text.foregroundStyle(LinearGradient(...))`.
1492    pub fn text_foreground_linear_gradient(self, colors: &[u64], start: (f64, f64), end: (f64, f64)) -> Self {
1493        Self::new(views::text_foreground_linear_gradient(&self.handle, colors, start, end))
1494    }
1495
1496    /// `.textInputAutocapitalization(_:)`. `None` means `nil` — defer to the field.
1497    ///
1498    /// The argument is `TextInputAutocapitalization?`, an optional wrapping a
1499    /// resilient struct. The payload is whatever the static getter writes; the
1500    /// discriminator goes in through `storeEnumTagSinglePayload` on the *payload's*
1501    /// witness table, which is the rule `abi::store_optional_tag` exists to keep.
1502    #[cfg(not(target_os = "macos"))]
1503    pub fn text_input_autocapitalization(self, style: Option<crate::views::TextInputCapitalization>) -> Self {
1504        Self::new(views::text_input_autocapitalization(&self.handle, style))
1505    }
1506
1507    /// Apply `.textInputCompletion(_:)`.
1508    pub fn text_input_completion(self, value: &str) -> Self {
1509        Self::new(views::text_input_completion(&self.handle, value))
1510    }
1511
1512    /// `Text.italic()`
1513    pub fn text_italic(self) -> Self {
1514        Self::new(views::text_italic(&self.handle))
1515    }
1516
1517    /// `Text.kerning(_:)` — space added between every pair of characters.
1518    pub fn text_kerning(self, amount: f64) -> Self {
1519        Self::new(views::text_kerning(&self.handle, amount))
1520    }
1521
1522    /// `Text.monospaced(_:)`
1523    pub fn text_monospaced(self) -> Self {
1524        Self::new(views::text_monospaced(&self.handle))
1525    }
1526
1527    /// `Text.tracking(_:)` — like kerning, but not suppressed between the pairs the
1528    /// font has a ligature for.
1529    pub fn text_tracking(self, amount: f64) -> Self {
1530        Self::new(views::text_tracking(&self.handle, amount))
1531    }
1532
1533    /// Apply `.tint(_:)` through the `Color?` overload.
1534    ///
1535    /// `View.tint` has two: one generic over `ShapeStyle`, which `tint` calls and
1536    /// which yields `_EnvironmentKeyWritingModifier<AnyShapeStyle?>`, and one taking
1537    /// a plain `Color?`, which yields `…<Color?>`. Swift picks the second for
1538    /// `.tint(.white)`, so a reference written that way disagrees with the first on
1539    /// both type and value.
1540    pub fn tint_color(self, color: u64) -> Self {
1541        Self::new(views::tint_color(&self.handle, color))
1542    }
1543
1544    /// The same, with the item placed somewhere other than `.automatic`.
1545    pub fn toolbar_customizable_placed(self, toolbar_id: &str, item_id: &str, placement: crate::views::ToolbarItemPlacement, shows_by_default: bool, content: View) -> Self {
1546        Self::new(views::toolbar_customizable_placed(&self.handle, toolbar_id, item_id, placement, shows_by_default, content.handle()))
1547    }
1548
1549    /// Apply `.toolbarItemHidden(_:)`.
1550    pub fn toolbar_item_hidden(self, value: bool) -> Self {
1551        Self::new(views::toolbar_item_hidden(&self.handle, value))
1552    }
1553
1554    /// Apply `.toolbar { ToolbarItem(placement:) { content } }`.
1555    ///
1556    /// `toolbar` above is this with `.automatic`, which is what the placement
1557    /// argument defaults to in Swift.
1558    pub fn toolbar_placed(self, placement: crate::views::ToolbarItemPlacement, content: View) -> Self {
1559        Self::new(views::toolbar_placed(&self.handle, placement, content.handle()))
1560    }
1561
1562    /// Apply `.touchBar(content:)`.
1563    pub fn touch_bar(self, content: View) -> Self {
1564        Self::new(views::touch_bar(&self.handle, content.handle()))
1565    }
1566
1567    /// Apply `.touchBarCustomizationLabel(_:)`.
1568    pub fn touch_bar_customization_label(self, value: &str) -> Self {
1569        Self::new(views::touch_bar_customization_label(&self.handle, value))
1570    }
1571
1572    /// Apply `.touchBarItemPresence(_:)`.
1573    ///
1574    /// The enum holds a `String`, which makes it larger than four words and so
1575    /// address-only: the argument is a pointer to a buffer this builds, with the
1576    /// string's two words written first and the tag injected by the enum's own
1577    /// witness afterwards.
1578    #[cfg(target_os = "macos")]
1579    pub fn touch_bar_item_presence(self, presence: crate::views::TouchBarItemPresence, identifier: &str) -> Self {
1580        Self::new(views::touch_bar_item_presence(&self.handle, presence, identifier))
1581    }
1582
1583    /// Apply `.touchBarItemPrincipal(_:)`.
1584    pub fn touch_bar_item_principal(self, value: bool) -> Self {
1585        Self::new(views::touch_bar_item_principal(&self.handle, value))
1586    }
1587
1588    /// Apply `.transformPreference(_:_:)`, doubling the value in place.
1589    pub fn transform_preference_double(self) -> Self {
1590        Self::new(views::transform_preference_double(&self.handle))
1591    }
1592
1593    /// Apply `.transition(.opacity)`.
1594    ///
1595    /// `AnyTransition` is eight bytes — a single class reference — so it is
1596    /// *loadable*: its static getters return it in x0 and it is passed by value.
1597    /// Reading it through an indirect (`x8`) return, as the larger resilient types
1598    /// like `Material` and `Glass` require, yields an uninitialised buffer whose
1599    /// contents are then released as if they were an object.
1600    pub fn transition_opacity(self) -> Self {
1601        Self::new(views::transition_opacity(&self.handle))
1602    }
1603
1604    /// Apply `.transition(.slide)` — in from the leading edge, out to the trailing.
1605    pub fn transition_slide(self) -> Self {
1606        Self::new(views::transition_slide(&self.handle))
1607    }
1608
1609    /// Apply `.typesettingLanguage(_:)`.
1610    pub fn typesetting_language(self, v0: crate::views::TypesettingLanguage, v1: bool) -> Self {
1611        Self::new(views::typesetting_language(&self.handle, v0, v1))
1612    }
1613
1614    /// Apply `.unredacted(_:)`.
1615    pub fn unredacted(self) -> Self {
1616        Self::new(views::unredacted(&self.handle))
1617    }
1618
1619    /// `.opacity(_:)`, taking `Color`'s own overload when the receiver is a `Color`.
1620    ///
1621    /// `Color.opacity(_:)` returns `Color` — the same shape as `Text.bold()` and
1622    /// `Image.resizable()`, and the reason Apple's `Color.primary.opacity(0.1)`
1623    /// types as a plain `Color` where the `View` extension gives
1624    /// `ModifiedContent<Color, _OpacityEffect>`. Both render identically; only one
1625    /// is the type the listing has.
1626    pub fn view_opacity(self, value: f64) -> Self {
1627        Self::new(views::view_opacity(&self.handle, value))
1628    }
1629
1630    pub fn window_dismiss_behavior(self, value: crate::views::WindowInteractionBehavior) -> Self {
1631        Self::new(views::window_dismiss_behavior(&self.handle, value))
1632    }
1633
1634    pub fn window_full_screen_behavior(self, value: crate::views::WindowInteractionBehavior) -> Self {
1635        Self::new(views::window_full_screen_behavior(&self.handle, value))
1636    }
1637
1638    pub fn window_minimize_behavior(self, value: crate::views::WindowInteractionBehavior) -> Self {
1639        Self::new(views::window_minimize_behavior(&self.handle, value))
1640    }
1641
1642    pub fn window_resize_behavior(self, value: crate::views::WindowInteractionBehavior) -> Self {
1643        Self::new(views::window_resize_behavior(&self.handle, value))
1644    }
1645
1646    pub fn window_toolbar_full_screen_visibility(self, value: crate::views::WindowToolbarFullScreenVisibility) -> Self {
1647        Self::new(views::window_toolbar_full_screen_visibility(&self.handle, value))
1648    }
1649
1650    /// Apply `.writingDirection(strategy:)`.
1651    pub fn writing_direction(self, strategy: crate::views::WritingDirectionStrategy) -> Self {
1652        Self::new(views::writing_direction(&self.handle, strategy))
1653    }
1654
1655    /// Apply `.writingToolsAffordanceVisibility(_:)`.
1656    pub fn writing_tools_affordance_visibility(self, value: crate::views::Visibility) -> Self {
1657        Self::new(views::writing_tools_affordance_visibility(&self.handle, value))
1658    }
1659
1660    pub fn writing_tools_behavior(self, value: crate::views::WritingToolsBehavior) -> Self {
1661        Self::new(views::writing_tools_behavior(&self.handle, value))
1662    }
1663
1664}