Post

Replies

Boosts

Views

Activity

LayoutConstraints error from NavigationView with navigationTitle
I'm trying to introduce a very simple NavigationView that contains a view and has a .navigationTitle() modifier. 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 'CBTrailingTrailing' UIModernBarButton:0x7f8e15614460'Hello World'.trailing <= UIButtonBarButton:0x7f8e15613a90.trailing  (active)>",   "<NSLayoutConstraint:0x600001994690 'UINavstaticbuttonhorizposition' 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:0x6000003801c0'UIViewLayoutMarginsGuide' - LTR  (active, names: '|':UINavigationBarContentView:0x7f8e1570e330 )>" ) Will attempt to recover by breaking constraint  <NSLayoutConstraint:0x6000019a7390 'BIBTrailingCBLeading' 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!
8
1
8.4k
Feb ’21