Toolbar button not showing in Canvas

This thread has been locked. Questions are automatically locked after two months of inactivity, or sooner if deemed necessary by a moderator.
Hi,
I have a toolbar and a share button on the left side. The button isn't showing up on the canvas, but does show when the app is run in the simulator or a device. Is this normal behavior or a bug? This is a test button so please forgive the print statement.

Here's the code:

Code Block .toolbar
        {
          ToolbarItem(placement: .bottomBar)
          {
            Button(action: {
              print ("Button Pressed!")
            }
              ){
              
              Image(systemName: "square.and.arrow.up")
            }
            }
        }


Up vote post of CPSoftware
97 views

Solved Answer

You need to embed the view in the preview code at the bottom inside a NavigationView.

Replies

You need to embed the view in the preview code at the bottom inside a NavigationView.
oh, that would help! Thanks.