What is the Secret of .toolbar in SwiftUI?

I am getting desperate with .toolbar in Xcode Version 12.2 beta 3 (12B5035g).

I have got this code:


Code Block
import SwiftUI
struct ContentView: View {
    let displayedStrings: [String]
    var body: some View {
        List(displayedStrings, id: \.self) { message in
            Text(message)
        }
        .navigationTitle("Messages")
        .toolbar {
            ToolbarItem(placement: .primaryAction) {
                Button("Primary Action") {}
            }
            
            #if os(iOS)
            ToolbarItem(placement: .bottomBar) {
                Button("Bottom Bar") {}
            }
            #endif
            ToolbarItem(placement: .status) {
                Button("Status") {}
            }
        }
    }
}
struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView(displayedStrings: ["String 1", "String 2", "String 3"])
    }
}


In Simulator (for iPhone 12 mini and iPad Air 4th gen) there is a toolbar at the bottom with two buttons:
  • "Button Bar", aligned left

  • "Status", aligned center

On macOS version 11.0 Beta (20A5395g) the app crashes on start:

Code Block
dyld`_dyld_debugger_notification:
->  0x113b12c6c <+0>: pushq  %rbp
    0x113b12c6d <+1>: movq   %rsp, %rbp
    0x113b12c70 <+4>: popq   %rbp
    0x113b12c71 <+5>: retq   


Items placed e.g. as .confirmationAction or .cancellationAction or .destructiveAction do not show anywhere at all.

I shall be most thankful for any directions pointing to working examples or instructions including toolbars for iOS and macOS in SwiftUI!
Answered by Hackberger in 643233022
The answer – or at least part of it – might be in today's release notes for 11.0.1:

Known Issues
A ToolbarItem with automatic placement isn't placed in the window toolbar. (63690384)

I guess it is just not ready.
In fact there was no crash, it was a breakpoint it I was not aware of. Sorry.

The rest of the question remains.

Thank you!
Accepted Answer
The answer – or at least part of it – might be in today's release notes for 11.0.1:

Known Issues
A ToolbarItem with automatic placement isn't placed in the window toolbar. (63690384)

I guess it is just not ready.
so it still doesnt show up on the bottom when you |> Continue program execution? or it does show up on mac and it was just a breakpoint you forgot was set on the line?
What is the Secret of .toolbar in SwiftUI?
 
 
Q