0

I'm getting 200 lines of AutoLayout errors in the console from SwiftUI's DatePicker. Looks like something to do with the label. In testing, this is happening in a blank project with nothing else in the view.

The logs are annoying but the more concerning part is it causes a long hitch in my app before the view is shown.

Is this happening to anyone else or am I missing something? Had trouble finding anything online about it. Not sure where to start or if there's anything I can even do about it.

To test, make a blank SwiftUI project, write the ContentView as such, and run:

struct ContentView: View {
    @State private var startTime: Date = Date()
    
    var body: some View {
        DatePicker("Test", selection: $startTime, displayedComponents: .hourAndMinute)
            .onChange(of: startTime) { newTime in
                print(newTime)
            }
    }
}
JBZic
  • 53
  • 6
  • 1
    I usually disable these when working with SwiftUI. Instructions here https://stackoverflow.com/q/31239934/725628 – EmilioPelaez Aug 29 '22 at 14:38
  • Thanks! Although that doesn't solve the in-app hitching. Perhaps just something we'll have to wait for Apple to fix... – JBZic Sep 06 '22 at 19:26
  • Looks like it's fixed -- I ran your code today in both iOS 15 and iOS 16 simulators and no autolayout warnings. – protasm Jul 03 '23 at 15:55

0 Answers0