init(_:selection:displayedComponents:)
Creates an instance that selects a Date with an unbounded range.
Declaration
nonisolated init(_ titleKey: LocalizedStringKey, selection: Binding<Date>, displayedComponents: DatePicker<Label>.Components = [.hourAndMinute, .date])Parameters
- titleKey:
The key for the localized title of
self, describing its purpose. - selection:
The date value being displayed and selected.
- displayedComponents:
The date components that user is able to view and edit. Defaults to
[.hourAndMinute, .date]. On watchOS, if.hourAndMinuteor.hourMinuteAndSecondare included with.date, only.dateis displayed.