I have a DatePicker of GraphicalDatePickerStyle and I want to center it inside a rectangle. My code:
HStack {
Spacer()
DatePicker("", selection: $notificationTimeOnPicker, displayedComponents: .hourAndMinute).foregroundColor(Color("ChartColor")).labelsHidden()
.datePickerStyle(GraphicalDatePickerStyle())
Spacer()
}
This is what I get and want:
How do I center my DatePicker? Looks like its frame is wide for some unknown reason. I tried changing its frame size to width: 95 or less to center it but after that I get ... instead of numbers when typing on some devices.