Contents

DatePickerComponents

The date and time components that a date picker shows.

Declaration

struct DatePickerComponents

Overview

Pass a value of this type as the displayedComponents argument of a DatePicker initializer to choose which parts of a date someone can edit. Combine options to show more than one group.

DatePicker(
    "Departure",
    selection: $departure,
    displayedComponents: [.hourAndMinute, .date]
)

A picker shows [.hourAndMinute, .date] unless you choose otherwise. Each option respects the current locale, so date orders the day, month, and year the way the person’s region expects.

Topics

Getting date picker components

See Also

Setting date picker components