79179812

Date: 2024-11-12 04:46:03
Score: 0.5
Natty:
Report link

As of iOS 17+, .labelsHidden() was all I needed to get the DatePicker alignment in the center.

DatePicker("", selection: $notificationTimeOnPicker, displayedComponents: .hourAndMinute)
.datePickerStyle(GraphicalDatePickerStyle())
.foregroundStyle(Color("ChartColor"))
.labelsHidden() // this solved my alignment issues caused by the default empty 'EmptyView' label that was hungrily taking up horizontal space.

I hope that solves it for anyone else looking for an answer in 2024!

Reasons:
  • Blacklisted phrase (0.5): I need
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Nathaniel