pub struct Modified<V> { /* private fields */ }Expand description
A view with modifiers applied (see ViewExt). Layout and look
modifiers apply in the order written, as SwiftUI’s do:
.frame(18.0, 18.0).padding(7.0) is an 18-point view with 7 points
around it, and .padding(16.0).background(..) puts the background under
the padding too, while .background(..).padding(16.0) doesn’t.
Implementations§
Source§impl<V: View> Modified<V>
impl<V: View> Modified<V>
Sourcepub fn popover<P: View>(
self,
shown: &Signal<bool>,
content: impl Fn() -> P + 'static,
) -> Self
pub fn popover<P: View>( self, shown: &Signal<bool>, content: impl Fn() -> P + 'static, ) -> Self
Shows content in a popover pointing at this view while shown is
true; closing it (Escape, a click outside) sets shown to false.
The content is built each time it opens and freed when it closes.
Sourcepub fn popover_on<P: View>(
self,
edge: Edge,
shown: &Signal<bool>,
content: impl Fn() -> P + 'static,
) -> Self
pub fn popover_on<P: View>( self, edge: Edge, shown: &Signal<bool>, content: impl Fn() -> P + 'static, ) -> Self
popover on a given side of the view.
Sourcepub fn on_command(self, command: Command, action: impl Fn() + 'static) -> Self
pub fn on_command(self, command: Command, action: impl Fn() + 'static) -> Self
Handles command while the focus is in this view (or nothing nearer
the focus handles it). See Command.
Sourcepub fn on_command_when(
self,
command: Command,
enabled: impl Fn() -> bool + 'static,
action: impl Fn() + 'static,
) -> Self
pub fn on_command_when( self, command: Command, enabled: impl Fn() -> bool + 'static, action: impl Fn() + 'static, ) -> Self
Handles command like on_command, enabled only
while enabled returns true (a disabled handler still answers: the
menu item is greyed out, and handlers further out aren’t asked).
A handler on a view answers only while the focus is in that view:
with the focus elsewhere (a search field, the sidebar) the command’s
menu item and its toolbar_command button
are greyed out unless a handler further out answers. That is right
for ⌘⌫ on a table (in a text field it deletes text). For a button
that should work wherever the focus is, give the window a handler
too (Window::on_command_when),
or use a toolbar_button with its own
action and .disabled(..).
Sourcepub fn focused_value<T: Clone + 'static>(
self,
name: &'static str,
value: T,
) -> Self
pub fn focused_value<T: Clone + 'static>( self, name: &'static str, value: T, ) -> Self
Publishes value under name while the focus is in this view, for
focused_value (a signal, typically: the
list’s selection, the editor’s document).
Sourcepub fn accessibility_label(self, label: impl IntoValue<String>) -> Self
pub fn accessibility_label(self, label: impl IntoValue<String>) -> Self
The name VoiceOver reads for this view’s native views.
A right-click menu on this view’s native views.
Sourcepub fn fill_width(self) -> Self
pub fn fill_width(self) -> Self
Takes all the width its container offers.
Sourcepub fn fill_height(self) -> Self
pub fn fill_height(self) -> Self
Takes all the height its container offers.
Sourcepub fn padding_xy(self, horizontal: f64, vertical: f64) -> Self
pub fn padding_xy(self, horizontal: f64, vertical: f64) -> Self
Inset left and right, and above and below (see ViewExt::padding_xy).
Sourcepub fn min_width(self, points: f64) -> Self
pub fn min_width(self, points: f64) -> Self
A minimum width (see ViewExt::min_width).
Sourcepub fn min_height(self, points: f64) -> Self
pub fn min_height(self, points: f64) -> Self
A minimum height (see ViewExt::min_height).
Sourcepub fn background(self, color: impl IntoValue<Color>) -> Self
pub fn background(self, color: impl IntoValue<Color>) -> Self
A background behind the view (see ViewExt::background).
Sourcepub fn corner_radius(self, points: f64) -> Self
pub fn corner_radius(self, points: f64) -> Self
Rounded corners for the background and border.
Sourcepub fn opacity(self, opacity: impl IntoValue<f64>) -> Self
pub fn opacity(self, opacity: impl IntoValue<f64>) -> Self
The view at opacity (see ViewExt::opacity).
Sourcepub fn font(self, font: Font) -> Self
pub fn font(self, font: Font) -> Self
The font of the text inside (see ViewExt::font).
Sourcepub fn color(self, color: impl IntoValue<Color>) -> Self
pub fn color(self, color: impl IntoValue<Color>) -> Self
The colour of the text and symbols inside (see ViewExt::color).
Sourcepub fn accessibility_value(self, value: impl IntoValue<String>) -> Self
pub fn accessibility_value(self, value: impl IntoValue<String>) -> Self
What VoiceOver reads as the value (see ViewExt::accessibility_value).
Sourcepub fn material(self, material: Material) -> Self
pub fn material(self, material: Material) -> Self
A system material behind the view (see ViewExt::material).
Sourcepub fn glass(self, glass: Glass) -> Self
pub fn glass(self, glass: Glass) -> Self
Liquid Glass behind the view (see ViewExt::glass).
Sourcepub fn matched_geometry(self, id: &str) -> Self
pub fn matched_geometry(self, id: &str) -> Self
Matched geometry (see ViewExt::matched_geometry).
Sourcepub fn transition(self, transition: Transition) -> Self
pub fn transition(self, transition: Transition) -> Self
How the view comes and goes (see ViewExt::transition).
Sourcepub fn on_hover(self, action: impl Fn(bool) + 'static) -> Self
pub fn on_hover(self, action: impl Fn(bool) + 'static) -> Self
Hover in and out (see ViewExt::on_hover).
Sourcepub fn hover_highlight(self, color: Color) -> Self
pub fn hover_highlight(self, color: Color) -> Self
A background while hovered (see ViewExt::hover_highlight).
Sourcepub fn tooltip(self, text: impl IntoValue<String>) -> Self
pub fn tooltip(self, text: impl IntoValue<String>) -> Self
A tooltip (see ViewExt::tooltip).
Sourcepub fn disabled(self, when: impl IntoValue<bool>) -> Self
pub fn disabled(self, when: impl IntoValue<bool>) -> Self
Disabled controls (see ViewExt::disabled).
Hidden while when() is true (see ViewExt::hidden).
Sourcepub fn on_click(self, action: impl Fn() + 'static) -> Self
pub fn on_click(self, action: impl Fn() + 'static) -> Self
The view as a button (see ViewExt::on_click).
Trait Implementations§
Auto Trait Implementations§
impl<V> !RefUnwindSafe for Modified<V>
impl<V> !Send for Modified<V>
impl<V> !Sync for Modified<V>
impl<V> !UnwindSafe for Modified<V>
impl<V> Forget for Modified<V>
impl<V> Freeze for Modified<V>where
V: Freeze,
impl<V> Move for Modified<V>
impl<V> Unpin for Modified<V>where
V: Unpin,
impl<V> UnsafeUnpin for Modified<V>where
V: UnsafeUnpin,
Blanket Implementations§
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<V> ViewExt for Vwhere
V: View,
impl<V> ViewExt for Vwhere
V: View,
Source§fn on_command(
self,
command: Command,
action: impl Fn() + 'static,
) -> Modified<Self>
fn on_command( self, command: Command, action: impl Fn() + 'static, ) -> Modified<Self>
command while the focus is in this view (see
Command).Source§fn on_command_when(
self,
command: Command,
enabled: impl Fn() -> bool + 'static,
action: impl Fn() + 'static,
) -> Modified<Self>
fn on_command_when( self, command: Command, enabled: impl Fn() -> bool + 'static, action: impl Fn() + 'static, ) -> Modified<Self>
command, enabled only while enabled returns true.Source§fn focused_value<T: Clone + 'static>(
self,
name: &'static str,
value: T,
) -> Modified<Self>
fn focused_value<T: Clone + 'static>( self, name: &'static str, value: T, ) -> Modified<Self>
Source§fn padding_xy(self, horizontal: f64, vertical: f64) -> Modified<Self>
fn padding_xy(self, horizontal: f64, vertical: f64) -> Modified<Self>
horizontal points left and right and vertical above and
below: a row’s .padding_xy(10.0, 7.0), as SwiftUI’s
.padding(.horizontal, 10) and .padding(.vertical, 7).Source§fn min_width(self, points: f64) -> Modified<Self>
fn min_width(self, points: f64) -> Modified<Self>
points wide (SwiftUI’s frame(minWidth:)).Source§fn min_height(self, points: f64) -> Modified<Self>
fn min_height(self, points: f64) -> Modified<Self>
points tall (SwiftUI’s frame(minHeight:)).Source§fn fill_width(self) -> Modified<Self>
fn fill_width(self) -> Modified<Self>
Source§fn fill_height(self) -> Modified<Self>
fn fill_height(self) -> Modified<Self>
Source§fn popover<P: View>(
self,
shown: &Signal<bool>,
content: impl Fn() -> P + 'static,
) -> Modified<Self>
fn popover<P: View>( self, shown: &Signal<bool>, content: impl Fn() -> P + 'static, ) -> Modified<Self>
Source§fn popover_on<P: View>(
self,
edge: Edge,
shown: &Signal<bool>,
content: impl Fn() -> P + 'static,
) -> Modified<Self>
fn popover_on<P: View>( self, edge: Edge, shown: &Signal<bool>, content: impl Fn() -> P + 'static, ) -> Modified<Self>
popover on a given side of the view.Source§fn accessibility_label(self, label: impl IntoValue<String>) -> Modified<Self>
fn accessibility_label(self, label: impl IntoValue<String>) -> Modified<Self>
text("Name:"), an icon button). A
closure keeps it current (move || format!("{} unread", n.get())).Source§fn background(self, color: impl IntoValue<Color>) -> Modified<Self>
fn background(self, color: impl IntoValue<Color>) -> Modified<Self>
corner_radius and shadow, a
card. Color::QuaternaryFill is the system’s grouped-card colour.
A closure computes it from signals (a selected row, a status); it
changes smoothly inside animated.Source§fn corner_radius(self, points: f64) -> Modified<Self>
fn corner_radius(self, points: f64) -> Modified<Self>
Source§fn border(self, color: Color, width: f64) -> Modified<Self>
fn border(self, color: Color, width: f64) -> Modified<Self>
width points wide around the view (inside its padding).Source§fn shadow(self, shadow: Shadow) -> Modified<Self>
fn shadow(self, shadow: Shadow) -> Modified<Self>
Source§fn opacity(self, opacity: impl IntoValue<f64>) -> Modified<Self>
fn opacity(self, opacity: impl IntoValue<f64>) -> Modified<Self>
opacity (0 transparent, 1 opaque), all of it, or a
closure computing it from signals; it fades inside
animated.Source§fn font(self, font: Font) -> Modified<Self>
fn font(self, font: Font) -> Modified<Self>
Source§fn color(self, color: impl IntoValue<Color>) -> Modified<Self>
fn color(self, color: impl IntoValue<Color>) -> Modified<Self>
Source§fn accessibility_value(self, value: impl IntoValue<String>) -> Modified<Self>
fn accessibility_value(self, value: impl IntoValue<String>) -> Modified<Self>
Source§fn material(self, material: Material) -> Modified<Self>
fn material(self, material: Material) -> Modified<Self>
corner_radius rounds it.Source§fn glass(self, glass: Glass) -> Modified<Self>
fn glass(self, glass: Glass) -> Modified<Self>
corner_radius
rounds it.Source§fn transition(self, transition: Transition) -> Modified<Self>
fn transition(self, transition: Transition) -> Modified<Self>
Source§fn matched_geometry(self, id: &str) -> Modified<Self>
fn matched_geometry(self, id: &str) -> Modified<Self>
matchedGeometryEffect): when, in one
animated change, a view with this id goes
and another with it comes (a thumbnail replaced by its detail, a
selection marker moving), the new one starts where and as large as
the old one was, and moves to its place.Source§fn on_hover(self, action: impl Fn(bool) + 'static) -> Modified<Self>
fn on_hover(self, action: impl Fn(bool) + 'static) -> Modified<Self>
action with true when the pointer moves over the view and
false when it leaves (while the app is active).Source§fn hover_highlight(self, color: Color) -> Modified<Self>
fn hover_highlight(self, color: Color) -> Modified<Self>
color while the pointer is over the view, fading
in and out: for rows and cards that can be clicked.Source§fn tooltip(self, text: impl IntoValue<String>) -> Modified<Self>
fn tooltip(self, text: impl IntoValue<String>) -> Modified<Self>
text appears in a small box when the pointer rests on
the view (SwiftUI’s help). VoiceOver reads it as the view’s help. A
closure keeps it current.when() is true, following the signals it
reads: its native views stay built (no rebuild, the state inside
kept) but aren’t shown, and it takes no room in its stack, as if it
weren’t there. For a panel shown in one mode only, rather than a
dynamic that rebuilds it each time. VoiceOver and Tab skip it.