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:
This currently behaves as designed. Context menus are generally not expected to contain images on the Mac per HI guidelines, whereas iOS/iPadOS context menus are expected to contain images. If you believe you have a good use case for images on your Mac context menu, I would encourage you to file a feedback report and describing your use case.