The missing SwiftUI DatePicker view for tvOS

What's New

Say hello to DatePicker for tvOS 👋

  • This is the first release of this package.
  • I chose the minor version 0.1.0 because I feel like that something is missing for 1.0.0 😛.

📅 TVDatePicker

A SwiftUI DatePicker view for tvOS

Swift 5.3 Platforms Current Version License

❤ī¸ Motivation

Currently there is no native SwiftUI DatePicker for tvOS. That's why I created this Swift package to fill the hole 😊 The API mimics the one of the native SwiftUI DatePicker available for iOS, macOS and macCatalyst.

ℹī¸ Installation

Just add this Swift package as a dependency to your Package.swift:

.package(url: "", from: "0.1.0")

🧭 Usage

The following code snippet shows how to use the DatePicker view in your tvOS application:

    _ titleKey: LocalizedStringKey,
    selection: Binding<Date>,
    minimumDate: Date,
    displayedComponents: Components = .all,
    calendar: Calendar = .current,
    dateFormatter: DateFormatter = DateFormatters.defaultFormatter,
    label: () -> Label
) // Available when Label conforms to View.

At first the view appears as a button with a horizontal stack containing the specified label, a Text view representing the current selection date string and a disclosure indicator Image view. If you press the button a sheet with the actual date picker view appears. The following screenshot is an example:

Screenshot of a date picker view usage example

📖 Implementation

The DatePicker view is implemented by using multiple Pickers with the SegmentedPickerStyle inside a List / VStack. Each Picker represents a date component like year, month or date. Due to issues with the focus engine the implementation slightly differs for the supported tvOS versions 13.0, 14.0 and > 14.0. But I think that you can ignore this detail in most cases.

🔒 Limitations

  • ⚠ī¸ The DatePicker was only tested with the Gregorian calendar.
  • The year component displays only 10 years at a time (selected year +/- 5 years with respect to the year of the specified minimum date).
  • ⚠ī¸ Currently only the year component respects the minimum date. On the contrary all months of a year and all days of a month are visible at all time.
  • Currently the hourAndMinute component always displays all 24 hours of a day.
  • The hourAndMinute component supports only steps by five for the minute.


  • Swift Tools 5.3.0
View More Packages from this Author


  • None
Last updated: Tue Nov 08 2022 02:44:24 GMT-0500 (GMT-05:00)