I'm trying to hide the back button name and the solution for this are these two lines:
.navigationBarHidden(true)
.navigationBarTitle("")
Everything works fine except this long console warning which makes debugging really hard as I need to scroll or filter a lot in order to see the desired output.
This line is causing it: .navigationBarTitle("")
Any ideas how to fix this?
Warnings:
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:0x600003823de0 'BIB_Trailing_CB_Leading' H:[_UIModernBarButton:0x11fe70c30]-(6)-[_UIModernBarButton:0x11fe6f370' '] (active)>",
"<NSLayoutConstraint:0x600003823e30 'CB_Trailing_Trailing' _UIModernBarButton:0x11fe6f370' '.trailing <= _UIButtonBarButton:0x11fe6eda0.trailing (active)>",
"<NSLayoutConstraint:0x600003850aa0 'UINav_static_button_horiz_position' _UIModernBarButton:0x11fe70c30.leading == UILayoutGuide:0x600002251500'UIViewLayoutMarginsGuide'.leading (active)>",
"<NSLayoutConstraint:0x600003850af0 'UINavItemContentGuide-leading' H:[_UIButtonBarButton:0x11fe6eda0]-(0)-[UILayoutGuide:0x600002251420'UINavigationBarItemContentLayoutGuide'] (active)>",
"<NSLayoutConstraint:0x60000383b7a0 'UINavItemContentGuide-trailing' UILayoutGuide:0x600002251420'UINavigationBarItemContentLayoutGuide'.trailing == _UINavigationBarContentView:0x11fe58990.trailing (active)>",
"<NSLayoutConstraint:0x600003851270 'UIView-Encapsulated-Layout-Width' _UINavigationBarContentView:0x11fe58990.width == 0 (active)>",
"<NSLayoutConstraint:0x60000383bb60 'UIView-leftMargin-guide-constraint' H:|-(0)-[UILayoutGuide:0x600002251500'UIViewLayoutMarginsGuide'](LTR) (active, names: '|':_UINavigationBarContentView:0x11fe58990 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x600003823de0 'BIB_Trailing_CB_Leading' H:[_UIModernBarButton:0x11fe70c30]-(6)-[_UIModernBarButton:0x11fe6f370' '] (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.
View:
struct HomeView: View {
var body: some View {
NavigationView {
VStack {
//
}
.navigationBarHidden(true)
.navigationBarTitle("") // Probably at least one of the constraints in the following list is one you don't want.
}
}
}
struct TabViewContainerView: View {
var body: some View {
TabView {
HomeView()
.tabItem {
Image(systemName: "house.fill")
}
.tag(0)
}
}
}