TEAM LICENSES: Save money and learn new skills through a Hacking with Swift+ team license >>

SOLVED: Prevent Toolbar from showing Overflow-Menu

Forums > SwiftUI

Hello!

I have a NavigationSplitView with items in the sidebars Toolbar.

Normally it looks like this:

However, when I select certain values, the appearance changes to something like this:

The "overflow menu" is empty. How can I prevent it from showing up?

My code looks like this:

//...
.toolbar {
  ToolbarItemGroup {
    Picker(...) {
        //...
    }
    Button {

    } label: {
      Image(systemName: "barcode.viewfinder")
        .font(.title2)

    }

  }
}

Thanks in advance!

2      

Maybe it will help to set the width frame for the displayed data? For example for ToolbarItemGroup or Picker .frame(width: UIScreen.main.bounds.size.width/number that fits)

"overflow menu" can be empty if any element (button) from the toolbar has no text.

2      

Thank you for your reply! :)

I didn't change the frame sizes in the end, but your suggestion made me play around with the components a bit more and I ended up just wrapping the Picker and Button in a HStack.

2      

Hacking with Swift is sponsored by String Catalog.

SPONSORED Get accurate app localizations in minutes using AI. Choose your languages & receive translations for 40+ markets!

Localize My App

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.