Date Selector
Represents a Material UI styled date selector for selecting dates.
Overview
The Date Selector provides a Material Design style date selector for selecting dates, presented as a modal overlay. It’s ideal for forms or settings where date selection is required. It adapts to different screen sizes and orientations, offering a flexible interface for date selection.
To use the dateSelector
modifier, apply it to any View with the required parameters. Below is the available method:
Modifier
Presents a date selector with a binding to control the presentation state and a binding to manage the selected date.
dateSelector(isPresented:Binding<Bool>, selection: Binding<Date>)
Parameters
Parameter
Description
isPresented
A binding to control the presentation state of the date selector.
selection
A binding to manage the selected date.
Example
@State private var isDateSelectorPresented: Bool = false
@State private var selectedDate: Date = Date()
var body: some View {
Container {
Switch("Show Date Selector", isOn: $isDateSelectorPresented)
}
.dateSelector(isPresented: $isDateSelectorPresented, selection: $selectedDate)
}


Last updated