Skip to main content

DatePicker

Struct DatePicker 

Source
pub struct DatePicker { /* private fields */ }
Expand description

A date (and optionally time) picker bound two ways to value.

Implementations§

Source§

impl DatePicker

Source

pub fn with_time(self) -> Self

Also picks the time of day.

Source

pub fn calendar(self) -> Self

A month calendar (clock too, with with_time) instead of a text field with a stepper.

Source

pub fn range(self, min: SystemTime, max: SystemTime) -> Self

Only dates from min to max can be picked.

Trait Implementations§

Source§

impl View for DatePicker

Source§

fn build(self, cx: &mut Cx) -> Node

Creates the node (native views are added to cx’s container).
Source§

fn id(self, id: impl Hash) -> AnyView
where Self: Sized,

Gives the view an identity: a dynamic region keeps the existing node instead of rebuilding when the new view has the same id.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AutoreleaseSafe for T
where T: ?Sized,

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V> ViewExt for V
where V: View,

Source§

fn on_command( self, command: Command, action: impl Fn() + 'static, ) -> Modified<Self>

Handles 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>

Handles command, enabled only while enabled returns true.
Source§

fn focused_value<T: Clone + 'static>( self, name: &'static str, value: T, ) -> Modified<Self>

Publishes value under name to the focus (see focused_value).
Source§

fn padding(self, points: f64) -> Modified<Self>

Inset on all sides, in points.
Source§

fn padding_xy(self, horizontal: f64, vertical: f64) -> Modified<Self>

Inset 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 width(self, points: f64) -> Modified<Self>

A fixed width.
Source§

fn min_width(self, points: f64) -> Modified<Self>

At least points wide (SwiftUI’s frame(minWidth:)).
Source§

fn min_height(self, points: f64) -> Modified<Self>

At least points tall (SwiftUI’s frame(minHeight:)).
Source§

fn height(self, points: f64) -> Modified<Self>

A fixed height.
Source§

fn frame(self, width: f64, height: f64) -> Modified<Self>

A fixed size.
Source§

fn fill_width(self) -> Modified<Self>

Takes all the width its container offers.
Source§

fn fill_height(self) -> Modified<Self>

Takes all the height its container offers.
Source§

fn popover<P: View>( self, shown: &Signal<bool>, content: impl Fn() -> P + 'static, ) -> Modified<Self>

Shows content in a popover pointing at this view while shown is true (see Modified::popover).
Source§

fn context_menu(self, items: Vec<MenuItem>) -> Modified<Self>

A right-click menu on this view’s native views.
Source§

fn accessibility_label(self, label: &str) -> Modified<Self>

The name VoiceOver reads for this view’s native views (“Name”, “Volume”), for controls whose visible label is a separate view or that have none (a field after a text("Name:"), an icon button).
Source§

fn background(self, color: impl IntoValue<Color>) -> Modified<Self>

A background behind the view, its padding included: with 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>

Rounds the corners of the view’s background and border, in points.
Source§

fn border(self, color: Color, width: f64) -> Modified<Self>

A border width points wide around the view (inside its padding).
Source§

fn shadow(self, shadow: Shadow) -> Modified<Self>

A drop shadow under the view’s background (give it a background).
Source§

fn opacity(self, opacity: impl IntoValue<f64>) -> Modified<Self>

The view at 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>

The font of the text inside the view (all of it, when it’s a row or a card): a text style or a custom font. Works after any modifier.
Source§

fn color(self, color: impl IntoValue<Color>) -> Modified<Self>

The colour of the text and symbols inside the view, or a closure computing it from signals. Works after any modifier.
Source§

fn accessibility_value(self, value: impl IntoValue<String>) -> Modified<Self>

What VoiceOver reads as the view’s value, after its name: a card’s state (“done”), a gauge’s level. A closure keeps it current.
Source§

fn material(self, material: Material) -> Modified<Self>

A system material behind the view, its padding included: a translucent sidebar, header or panel that blurs what’s behind it. corner_radius rounds it.
Source§

fn glass(self, glass: Glass) -> Modified<Self>

Liquid Glass behind the view, its padding included (macOS 26; a translucent material on macOS 15). corner_radius rounds it.
Source§

fn background_when(self, color: impl Fn() -> Color + 'static) -> Modified<Self>

👎Deprecated since 0.4.0:

background takes a closure: .background(move || ..)

A background following signals (now background takes a closure).
Source§

fn opacity_when(self, opacity: impl Fn() -> f64 + 'static) -> Modified<Self>

👎Deprecated since 0.4.0:

opacity takes a closure: .opacity(move || ..)

Opacity following signals (now opacity takes a closure).
Source§

fn transition(self, transition: Transition) -> Modified<Self>

How the view comes and goes when it’s added or removed (by dynamic or for_each) inside animated.
Source§

fn matched_geometry(self, id: &str) -> Modified<Self>

Matched geometry (SwiftUI’s 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>

Calls 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>

A background of 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: &str) -> Modified<Self>

A tooltip: text appears in a small box when the pointer rests on the view (SwiftUI’s help). VoiceOver reads it as the view’s help.
Source§

fn disabled(self, when: impl IntoValue<bool>) -> Modified<Self>

Disables the view’s controls while when() is true (a picker that only matters once a checkbox is on, a form while it’s saving), following the signals it reads. SwiftUI’s disabled.
Source§

fn on_click(self, action: impl Fn() + 'static) -> Modified<Self>

Makes the whole view a button: a click on it calls action, it dims while pressed, and VoiceOver reads it as a button named by its text. For rows, cards and tiles; controls inside it don’t get clicks.
Source§

impl<V> Views for V
where V: View,

Source§

fn into_views(self) -> Vec<AnyView>

Erases the children, in order.