Swiftpack.co - freyaalminde/watch-date-picker as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by freyaalminde.
freyaalminde/watch-date-picker 0.3.0
A customizable date picker for watchOS and SwiftUI.
⭐️ 41
🕓 4 weeks ago
.package(url: "https://github.com/freyaalminde/watch-date-picker.git", from: "0.3.0")

Watch Date Picker

A customizable date picker for watchOS and SwiftUI.


Add the https://github.com/freyaalminde/watch-date-picker package, then add the WatchDatePicker product to your app’s WatchKit extension target.


The DatePicker view displays a button with a title and the selected value. When pressed, it presents a user interface for selecting date, time, or both.

Watch Date Picker is designed to look and feel similar to the system’s date and time pickers, seen in apps such as Alarms, Calendar, and Reminders, with an API matching SwiftUI’s built-in DatePicker.

Selecting Date and Time

    "Date & Time",
    selection: $value

Selecting a Date

    selection: $value,
    displayedComponents: .date

Selecting a Time

    selection: $value,
    displayedComponents: .hourAndMinute


DateInputView and TimeInputView, the two views which DatePicker is primarily composed of, can be used on their own.

Date Input View

The date input view displays three pickers for selecting day, month, and year.

DateInputView(selection: $value)

The date input view uses the current locale for labeling and ordering the day-month-year pickers.

DateInputView(selection: $value)
    .environment(\.locale, Locale(identifier: "fr"))

Time Input View

The time input view displays a clock dial for selecting hour and minute. In locales with AM/PM-based time, AM/PM buttons will be displayed, otherwise 24-hour mode is used.

TimeInputView(selection: $value)

24-hour mode can be explicitly enabled or disabled regardless of locale.

TimeInputView(selection: $value)

TimeInputView(selection: $value)

The 24-hour mode indicator can be hidden.

TimeInputView(selection: $value)

See the documentation for more options.


Watch Date Picker works in all languages supported by watchOS: Arabic, Bulgarian, Catalan, Chinese (Simplified), Chinese (Traditional), Croatian, Czech, Danish, Dutch, English, Finnish, French, German, Greek, Hebrew, Hindi, Hungarian, Indonesian, Italian, Japanese, Kazakh, Korean, Malay, Norwegian, Polish, Portuguese (Brazil), Portuguese (Portugal), Romanian, Russian, Slovak, Spanish, Spanish (Latin America), Swedish, Thai, Turkish, Ukrainian, and Vietnamese.

Translations are based on Apple’s glossaries, thus they should feel at home in each locale.

A script is run to take screenshots for every locale and screen size to ensure everything renders correctly.


Stars: 41
Last commit: 4 weeks ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

4 weeks ago

It’s time for a new release and I’m happy to announce that version 0.3.0 includes:

  • Date-only date pickers now show a “Set” button instead of circular buttons.
  • Step two of date-and-time date pickers now use circular buttons and no longer show the status bar.
  • The date selection interface of date pickers no longer hides current time from the status bar.
  • Added support for optional selection. This displays a clear button when used.
  • Improved performance by caching results of Locale-related functions.
  • Fixed an issue where 12 AM would be read by VoiceOver as “0 o’clock AM”.
  • Fixed an issue where the minute component wouldn’t be selected while using VoiceOver.

Let me know what you think of the adjusted appearance! Should there be customization options for some of it?

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics