Contents

init(selection:displayedComponents:label:)

Creates an instance that selects a Date with an unbounded range.

Declaration

nonisolated init(selection: Binding<Date>, displayedComponents: DatePicker<Label>.Components = [.hourAndMinute, .date], @ViewBuilder label: () -> Label)

Parameters

  • 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.

  • label:

    A view that describes the use of the date.

See Also

Creating a date picker for any date