0

I am developing an macCatalyst app with a simple NavigationView and a toolbar. As soon as I give my toolbarItem the .principal placement the toolbar increases in height (nearly doubles). In the Image you can see the large Space between "MyButton" and the border of the view.

enter image description here

struct ContentView: View {
    @State var toggle = false
    var body: some View {
        NavigationView {
            VStack {
                Text("Sidebar")
            }
            .padding()
            
            VStack {
                Spacer()
                Text("Hello, world!")
                Spacer()
            }
            .frame(maxWidth: .infinity, maxHeight: .infinity)
            .background(.yellow)
            .border(.red)
            .toolbar {
                ToolbarItemGroup(placement: .principal) {
                    Button {
                        toggle.toggle()
                    } label: {
                        Text("MyButton")
                            .foregroundColor(Color.accentColor)
                    }
                }
            }
        }
    }
}

When the placement of my toolbarItem is .automatic, .navigation, ... the height is normal again.

I am searching for a solution for that problem since a long time now... Some Ideas?

printDavid
  • 165
  • 1
  • 9

0 Answers0