Since macOS 13, the primaryAction no longer displays next on left to the search bar
MainView()
.toolbar {
ToolbarItem {
Spacer()
}
ToolbarItemGroup(placement: .status) {
Text("Status")
}
ToolbarItemGroup(placement: .principal) {
Text("Principal")
}
ToolbarItemGroup(placement: .primaryAction) {
Text("Primary")
}
ToolbarItemGroup(placement: .keyboard) {
Text("Keyboard")
}
ToolbarItemGroup(placement: .secondaryAction) {
Text("Secondary")
}
ToolbarItem {
Text("Noplacement")
}
}
.searchable(text: .constant(""))
how to position a toolbar item the topmost right next to search?
Note: without the search bar, they are put correctly to rightmost position


You simply need to add a Spacer()
Here's what it looks like