Contents

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 .hourAndMinute or .hourMinuteAndSecond are included with .date, only .date is displayed.

See Also

Creating a date picker for any date