bottomBar causes un-satisfied constraints

On Xcode 13.3 and iOS15.4 I don't found a way to add something in the bottom bar without Xcode warning. This sample of swiftUI code:

{
	var body: some View {
		Text("Hello, World!")
			.toolbar {
				ToolbarItem(placement: .bottomBar) {
					Text("Bottom Bar")
				}
			}
	}
}

causes: "Unable to simultaneously satisfy constraints." (a long list follows).

Am I missing something?

Replies

I tested with no error, but no toolbar either.

You need to include in a navigationView:

    var body: some View {
        NavigationView {
            Text("Hello, World!").padding()
                .navigationTitle("SwiftUI")
                .toolbar {
                    ToolbarItem(placement: .bottomBar) {
                        Text("Bottom Bar")
                    }
                }
        }
    }
  • Hi Claude and thank you for your replay. I attempted also with Navigation View, now I replicated copying your example. With Xcode 13.3 and iOS15.4 on iPhone 6s and on Simulators. In all cases I had "LayoutConstraints" warnings. With your example I had the toolbar. With which environment did you tested?

Add a Comment

I tested the code in both Xcode 13.2 / iOS 15.2 and iwith Xcode 13.3 / iOS 15.4.

Both work.

  • Without .navigationTitle("SwiftUI") the issue isn't anymore present.

Add a Comment