Having issues with DatePicker iOS14

Hi guys! I'm trying to implement a DatePicker in my app, everything works find except for one thing. When I select the DatePicker I receive this huge warning (I attached a text file that contains the full warning).
Code Block
[LayoutConstraints] Unable to simultaneously satisfy constraints.

This is only the first part of the warning. Please check the full error attached.

On an iPhone, the DatePicker looks good but on an iPad it is very small relative to the iPad screen.

This is my code
Code Block Swiftui
// Date picker
DatePicker(selection: $selectedDate, in: ...Date(), displayedComponents: .date) {
Text("")
}
.padding(.trailing)
.onChange(of: self.selectedDate, perform: { date in
// Do something
})

Any ideas about the error?

Thank you.




Usually, you can ignore such warnings, system copes with it gracefully.

But they are annoying for sure.

You have probably one extra constraint defined (but in SwiftUI, have you defined any constraint yourself ?).

If you have defined such constraint for the label, check its trailing constraints.
If not, you could file a bug report.
I can confirm, having the same bug, with a very simple form

Code Block
Form {
Section {
DatePicker(self.label, selection: self.value)
}
}



2020-11-29 21:11:08.171127+0100 Budgetify[85909:3309604] [Warning] Warning once only: Detected a case where constraints ambiguously suggest a height of zero for a table view cell's content view. We're considering the collapse unintentional and using standard height instead. Cell: <SwiftUI.ListCoreCellHost: 0x7ffdbc08f800; baseClass = UITableViewCell; frame = (0 123; 788 44); autoresize = W; layer = <CALayer: 0x60000223b960>>

Having the same issue in:

  • iOS 16.0 (20A362)
  • and Xcode 14.0 (14A309).
Having issues with DatePicker iOS14
 
 
Q