I have something like this and both toolbars are on the same line. I want them both stacked on top of each other. One toolbar on top of the other:
struct ToolbarView: View {
@ObservedObject var dm: DrawModel
init( _ dm: DrawModel ) { self.dm = dm }
var body: some View {
VStack{ }
.toolbar
{
AddToolbarItems( dm, toolbar1 )
}
.toolbar {
AddToolbarItems( dm, toolbar2 )
}
}
}
To be clearer the toolbar buttons are showing up like this. Where TB is a toolbar and the 2.1 is Toolbar 2 item 1. etc
TB2.1 TB2.2 TB1.1 TB1.2
Like this instead:
TB1.1 TB1.2
TB2.1 TB2.2
Edit-1

how about you try
AddToolbarItems( dm, toolbar2 )first followed byAddToolbarItems( dm, toolbar1 ), to give you what youlike this instead: TB1.1 TB1.2 TB2.1 TB2.2.Alternatively:
EDIT-1:
If you have only the four items mentioned, then to display 2 sets of 2 items, you could try this:
Better still, have the
HStackin yourAddToolbarItems.However, if you have many items, there may not be enough space for all of them. Note, the height of the
.toolbaris determined by the system and cannot be changed. You can of course create your own custom toolbar, without using the.toolbarmodifier, very easy to do and you can choose whatever size you want.EDIT-2
Here is my full test code that works for me.
Here is a screen shot when using my code with Button and systemImage.