I tried to configure the button in the contextMenu
, but it's not working.
Text("A label that have context menu")
.contextMenu {
Button(action: {
// remove it
}) {
Text("Remove")
.foregroundColor(.red) // Not working
Image(systemName: "trash")
}.disabled(true) // Not working
}
what I have:
What I'm seeking: (delete and call buttons)
I would create a UIAction
like the following in UIKit
but I can't find any modifier or anyway to bring this to the SwiftUI:
let delete = UIAction(title: "Remove", image: UIImage(systemName: "trash"), attributes: .destructive) { action in
// remove it
}