I have a NavigationVeiw that has a ToolbarItem on the trailing side of its navigation-bar.
.toolbar {
ToolbarItem(placement: .navigationBarTrailing) {
Button(action: {}, label: {
Text("Button")
})
}
}
navigationBarItems(leading:trailing:)is deprecated. Therefore, I am using toolbar(content:) with navigationBarTrailing placement. - Apple
I have used contextMenu on the Button.
.toolbar {
ToolbarItem(placement: .navigationBarTrailing) {
Button(action: {}, label: {
Text("Button")
})
.contextMenu(menuItems: {
Text("Menu Item 1")
Text("Menu Item 2")
Text("Menu Item 3")
})
}
}
It's not sensitive. You have to press hard to present it. I need to present it with a single touch like iOS Photo App's Add button. It is presented with a single touch.
How to show Menu with a single touch (not press)?