SwiftUI TextFields on vanilla brand new project giving errors [LayoutConstraints]. How to fix it?

431 views Asked by At

I just created a vanilla brand new SwiftUI project with the most basic possible view for a textfields with not styling whatsoever:

struct ContentView: View {
    @State private var email = ""
    @State private var password = ""
    
    var body: some View {
        VStack {
            TextField("Email", text: $email)
            SecureField("Password", text: $password)
        }
    }

}

And I am getting this very annoying and frustrating error. Please I am aware that everything still works despite the warning, but I want to get rid of this no matter what. How to do that?

2023-04-27 09:43:13.444617+0400 Test[16580:1186362] [LayoutConstraints] Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want. 
    Try this: 
        (1) look at each constraint and try to figure out which you don't expect; 
        (2) find the code that added the unwanted constraint or constraints and fix it. 
(
    "<NSLayoutConstraint:0x282228320 'accessoryView.bottom' _UIRemoteKeyboardPlaceholderView:0x11d1105c0.bottom == _UIKBCompatInputView:0x11be0f3b0.top   (active)>",
    "<NSLayoutConstraint:0x282229900 'assistantHeight' SystemInputAssistantView.height == 45   (active, names: SystemInputAssistantView:0x11d205d00 )>",
    "<NSLayoutConstraint:0x2822216d0 'assistantView.bottom' SystemInputAssistantView.bottom == _UIKBCompatInputView:0x11be0f3b0.top   (active, names: SystemInputAssistantView:0x11d205d00 )>",
    "<NSLayoutConstraint:0x282221680 'assistantView.top' V:[_UIRemoteKeyboardPlaceholderView:0x11d1105c0]-(0)-[SystemInputAssistantView]   (active, names: SystemInputAssistantView:0x11d205d00 )>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x282221680 'assistantView.top' V:[_UIRemoteKeyboardPlaceholderView:0x11d1105c0]-(0)-[SystemInputAssistantView]   (active, names: SystemInputAssistantView:0x11d205d00 )>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.

Please note, no styling whatsoever anywhere added. This is brand new vanilla project. How to get rid of this error by any means necessary?

0

There are 0 answers