LayoutConstraints error from NavigationView with navigationTitle

I'm trying to introduce a very simple NavigationView that contains a view and has a .navigationTitle() modifier.

Code Block
import SwiftUI
struct LandingPageView: View {
  var body: some View {
    NavigationView {
      Text("Hello")
        .navigationTitle("Hello World")
    }
  }
   
  struct LandingPageView_Previews: PreviewProvider {
    static var previews: some View {
      LandingPageView()
    }
  }
}


I would expect the Text View to be created with Hello World as the title for that view. This is what I see, but with the following error:



2021-02-08 13:59:22.635449+0000 SupplyLine[63126:3757074] [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:0x6000019a7390 'BIBTrailingCBLeading' H:[UIModernBarButton:0x7f8e15616be0]-(6)-[UIModernBarButton:0x7f8e15614460'Hello World']  (active)>",
  "<NSLayoutConstraint:0x6000019a73e0 'CB
TrailingTrailing' UIModernBarButton:0x7f8e15614460'Hello World'.trailing <= UIButtonBarButton:0x7f8e15613a90.trailing  (active)>",
  "<NSLayoutConstraint:0x600001994690 'UINav
staticbuttonhorizposition' UIModernBarButton:0x7f8e15616be0.leading == UILayoutGuide:0x6000003801c0'UIViewLayoutMarginsGuide'.leading  (active)>",
  "<NSLayoutConstraint:0x6000019946e0 'UINavItemContentGuide-leading' H:[UIButtonBarButton:0x7f8e15613a90]-(0)-[UILayoutGuide:0x6000003fc1c0'UINavigationBarItemContentLayoutGuide']  (active)>",
  "<NSLayoutConstraint:0x6000019b3e30 'UINavItemContentGuide-trailing' UILayoutGuide:0x6000003fc1c0'UINavigationBarItemContentLayoutGuide'.trailing ==
UINavigationBarContentView:0x7f8e1570e330.trailing  (active)>",
  "<NSLayoutConstraint:0x60000199f660 'UIView-Encapsulated-Layout-Width' _UINavigationBarContentView:0x7f8e1570e330.width == 0  (active)>",
  "<NSLayoutConstraint:0x6000019abd90 'UIView-leftMargin-guide-constraint' H:|-(0)-[UILayoutGuide:0x6000003801c0UIViewLayoutMarginsGuide](LTR)  (active, names: '|':UINavigationBarContentView:0x7f8e1570e330 )>"
)
Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x6000019a7390 'BIB
TrailingCBLeading' H:[UIModernBarButton:0x7f8e15616be0]-(6)-[UIModernBarButton:0x7f8e15614460'Hello World']  (active)>
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.

I do believe this issue is similar to https://stackoverflow.com/questions/65316497/swiftui-navigationview-navigationbartitle-layoutconstraints-issue however the discussion there seems inconclusive.

Thanks!
I would worry about this. There isn’t anything wrong with your code, and there doesn’t seem to be anything you can do about the error. Most of the time you’ll find that Xcode will output a lot of useless messages, like this one, that doesn’t concern you.

This seems to be a new message in Xcode 12 that is outputted to the terminal.

you can fix this by giving the NavigationView a navigationViewStyle modifier

NavigationView {
            VStack {
                    Text("some content")
                    Text("some content")
                }
            }
            .navigationTitle("SOLVE CONSTRAIN MESSAGE")
        }
        .navigationViewStyle(.stack)
14

Xcode 13.2.1 and we still have the issue When the iPhone is in the landscape orientation.

As today works only with navigationViewStyle using column, or automatic, on iPad started in landscape, I filed a Feedback in Feedback Assistant with a sample project.

I have this problem too. Adding a ".navigationViewStyle" is not solving either. I am using Xcode 13.3 on MacOS 12.3 using Apple Silicon.

I have the same problem in Xcode 13.3.1, macOS 12.3.1, iOS 15.4. Sometimes I wonder if Apple is serious about supporting SwiftUI. This seems like a really basic bug in an extremely common code pattern.

Xcode 13.4.1 and using the .navigationViewStyle(.stack) hung off the NavigationView {} works without tossing errors. Automatic tosses errors and Columns is iOS 15 only(did not try).

spawlak is do the right solving. try this: NavigationView { }.navigationViewStyle(.stack) and i am realy confuse that somtime put navigationTitle inside the "}" and put navigationViewStyle outside the "}" serious?

LayoutConstraints error from NavigationView with navigationTitle
 
 
Q