code:
let action1 = UIAction(title: "Restore".localized, image: UIImage(resource: .listRestore)) { [weak self] action in
self?.trashRestoreTapped(id: button.tag)
}
let action2 = UIAction(title: "Delete".localized, image: UIImage(resource: .listDelete), attributes: [.destructive]) { [weak self] action in
self?.trashDeleteTapped(id: button.tag)
}
button.menu = UIMenu(options: .displayInline, preferredElementSize: .large, children: [action1, action2])
button.showsMenuAsPrimaryAction = true
MacOS 15.1:
iPad: