Hi there! I may resolved this issue.
The approach is open date picker by the programmatically.
But It is may lack of accuracy
Use the following link to programmatically open the Date Picker
How to trigger SwiftUI datepicker programmatically
This question uses a button to display the Date Picker, but we need to open the Date Picker using onTapGesture
.
DatePicker("", selection: $date, displayedComponents: .date)
.accessibilityIdentifier(pickerId)
.onTapGesture {
triggerDatePickerPopover()
}
Besides, just implementing the previous solution did not work. (For some reason, triggerDatePickerPopover()
did not get the Date Picker properly.)
In my case, I opened the Accessibility Inspector in Xcode and clicked on the target Date Picker, and after that, I was able to get it to work.
Hope everyone's problems will be solved soon!
Thank you.
(I used a translator, so my English may be strange!)