@@ -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,7 +33,6 @@ public struct DatePickerComponents: OptionSet, Sendable {
2133 public static let hourMinuteAndSecond = DatePickerComponents ( rawValue: 0xE0 )
2234}
2335
24- @available ( tvOS, unavailable)
2536public enum DatePickerStyle : Sendable , Hashable {
2637 /// A date input chosen by the backend.
2738 case automatic
@@ -58,7 +69,7 @@ public struct DatePicker<Label: View> {
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 ) {
@@ -79,7 +90,7 @@ public struct DatePicker<Label: View> {
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