Hi All, I have a macOS app written in SwiftUI where I want to add a simple drop down button with a menu to the toolbar for a view. It currently looks like this:
You can see that there is no gap between the drop down arrow and the symbol. And the icon/symbol color sometimes seems to be grayed out. When the app starts it also shows black sometimes (not constantly reproducible).
var body: some Scene {
WindowGroup {
ContentView()
.frame(maxWidth: .infinity, maxHeight: .infinity)
.navigationTitle("Title")
.toolbar {
ToolbarItem(placement: .primaryAction) {
Menu {
Button {
...
} label: {
Text("Open cache directory")
}
.help("Show application support folder")
.disabled(applicationSupportDirectory == nil)
Button {
...
} label: {
Text("Clear cache")
}
.help("Clears all content from the cache")
.disabled(applicationSupportDirectory == nil)
} label: {
Image(systemName: "gear")
}
}
}
}
.windowToolbarStyle(.unified)
}
I basically want to have a simple drop down toolbar item with a few menu items. The app is pretty new so it does not have any fancy code just yet. I wonder what I am missing. Looking forward to have a button like this:
I tried different symbols, applying padding and frame width on the Image. I tried different placements and ToolbarItemGroup. Strangely enough: When setting the toolbar style to unifiedcompact, at least the spacing works. But the colouring is still strange. Nothing helped so far.