@@ -12,6 +12,18 @@ public struct DatePickerComponents: OptionSet, Sendable {
1212 self . rawValue = 0
1313 }
1414
15+ /*
16+ * These magic numbers are the same as SwiftUI. It's actually a bitfield:
17+ *
18+ * smhdMy--
19+ * date 00011100
20+ * hourAndMinute 01100000
21+ * hourMinuteAndSecond 11100000
22+ *
23+ * Like SwiftUI, not all combinations are valid (SwiftUI fatalErrors if you try to get creative
24+ * with your choice of flags), and hourMinuteAndSecond intentionally includes hourAndMinute.
25+ */
26+
1527 public static let date = DatePickerComponents ( rawValue: 0x1C )
1628 public static let hourAndMinute = DatePickerComponents ( rawValue: 0x60 )
1729
@@ -21,9 +33,8 @@ public struct DatePickerComponents: OptionSet, Sendable {
2133 public static let hourMinuteAndSecond = DatePickerComponents ( rawValue: 0xE0 )
2234}
2335
24- @available ( tvOS, unavailable)
2536public enum DatePickerStyle : Sendable , Hashable {
26- /// A date input chosen by the backend .
37+ /// A date input that adapts to the current platform and context .
2738 case automatic
2839
2940 /// A date input that shows a calendar grid.
@@ -54,11 +65,11 @@ public struct DatePicker<Label: View> {
5465 /// - range: The range of dates to display. The backend takes this as a hint but it is not
5566 /// necessarily enforced. As such this parameter should be treated as an aid to validation
5667 /// rather than a replacement for it.
57- /// - displayedComponents: What parts of the date/time to display in the input.
68+ /// - displayedComponents: Which parts of the date/time to display in the input.
5869 /// - label: The view to be shown next to the date input.
5970 public nonisolated init (
6071 selection: Binding < Date > ,
61- range: ClosedRange < Date > = Date . distantPast... Date . distantFuture,
72+ in range: ClosedRange < Date > = Date . distantPast... Date . distantFuture,
6273 displayedComponents: DatePickerComponents = [ . hourAndMinute, . date] ,
6374 @ViewBuilder label: ( ) -> Label
6475 ) {
@@ -75,11 +86,11 @@ public struct DatePicker<Label: View> {
7586 /// - range: The range of dates to display. The backend takes this as a hint but it is not
7687 /// necessarily enforced. As such this parameter should be treated as an aid to validation
7788 /// rather than a replacement for it.
78- /// - displayedComponents: What parts of the date/time to display in the input.
89+ /// - displayedComponents: Which parts of the date/time to display in the input.
7990 public nonisolated init (
8091 _ label: String ,
8192 selection: Binding < Date > ,
82- range: ClosedRange < Date > = Date . distantPast... Date . distantFuture,
93+ in range: ClosedRange < Date > = Date . distantPast... Date . distantFuture,
8394 displayedComponents: DatePickerComponents = [ . hourAndMinute, . date]
8495 ) where Label == Text {
8596 self . label = Text ( label)
0 commit comments